View Single Post
 
Old 04-11-2016, 12:48 AM
rsrasc rsrasc is offline Windows 10 Office 2013
Competent Performer
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Need Macro to Convert Text To Numbers in Multiple Sheets

Hi all,

I have a file with 40 sheets. The first sheet is named "MyData". The other 39 sheets are named "Page 1" thru "Page 39".

The following code works fine for sheet "MyData".

I have searched the Internet to see if I could find information or a macro that will help me do the same for the other 39 sheets but I have not been successful.


Code:
 
Sub Converting_Text_To_Numbers_1()
 
    Range("D6:F385").Select 'specify the range which suits your purpose-same range for all other sheets
 
 
    With Selection
        Selection.NumberFormat = "###000"
        .Value = .Value
    End With
 
End Sub

For example, the following two (2) codes below are working fine for the 39 sheets but I can't get it to work with the above code.

So if someone can help me with this, I will appreciate it.

Code:
Sub Check_NumberUnMerged()
'
' testmac1 Macro
'
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    With ws
        .Range("CB6:CC205").UnMerge
 
    ' and so on
    '
    End With
Next ws
End Sub

Code:
 
Sub ChangeFont()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
    ws.Cells.Font.Name = "Calibri"
    ws.Cells.Font.Size = "10"
Next
End Sub
Thanks!
Reply With Quote