label_to_number

T

transferxxx

Can someone correct macro below - Getting error : "Method 'Range' of
object_Global failed.



Sub label_to_number()
Dim addr As String
For Each Window In Windows
For Each Worksheet In Window.SelectedSheets
For Each cell In Application.Selection
addr = Worksheet.Name & "!" & cell.Address
If IsNumeric(Range(addr).Value) = True And Range(addr).Text <> "" And
Range(addr).HasFormula = False Then
Range(addr) = Val(Range(addr))
End If
Next cell
Next Worksheet
Next Window
End Sub
 
M

Mangesh

Probably you require to give the parent of the RANGE you have used.
For instance:
Worksheets("Sheet1").Range(addr).Value

Mangesh
 
T

transferxxx

Don't think that's the solution as the macro need to work as a general macro
in any workbook with different sheet name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top