Hi,
I want to format the columns into percentage where in the field name the "%" character exsist. I made a script which looks for the % character and formats the column accordingly. The problem starts when it goes to anoter worksheet and cannot the percentage character (which is good) but how can I step out of this error and continue to the next worksheet. I tried on error resume next but the error keeps returning "Run time error 91"
This is the code:
Code:
Sub find()
'
'This section is to find an '%' character and change that column with the propper format
On Error GoTo errtestproc
'Worksheets(2).Activate
Range("a1", Selection.End(xlToRight)).Select
c = Selection.Columns.Count
q = Selection.End(xlToRight).Address
lastcolumnletter = Mid(q, 2, (InStr(2, q, "$")) - 2)
Do
On Error Resume Next
a = Cells.find(What:="%", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Address
mycolumnletter = Mid(a, 2, (InStr(2, a, "$")) - 2)
Range(mycolumnletter & "1").Select
Columns(mycolumnletter & ":" & mycolumnletter).Select
Selection.NumberFormat = "0%"
Loop While Not mycolumnletter = lastcolumnletter
Exit Sub
errtestproc:
MsgBox "test"
Resume
End Sub