Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default label_to_number

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default label_to_number

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

Mangesh



On Aug 8, 10:30 am, transferxxx wrote:
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default label_to_number

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


"Mangesh" wrote:

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

Mangesh



On Aug 8, 10:30 am, transferxxx wrote:
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"