I have a code to do a particular modification to some cells in a page. I'd like to apply this code at one click to all the pages in the excel file. I'm using VBA and am a newbie to it. Here's my code :
Sub H()
Dim B As Range, H As Range, I As Range
For Each B In Range("B7:B49").Cells
If IsNumeric(B) And B <> "" Then
Cells(B.Row, 9) = Trim(Cells(B.Row + 1, 8)) & Trim(Cells(B.Row + 2, 8))
Cells(B.Row + 1, 8) = ""
Cells(B.Row + 2, 8) = ""
If B.Row > 50 Then Exit For
End If
Next B
End Sub
I'd like to apply the above macro to all the pages in the excel sheet. How can I do that?
No comments:
Post a Comment