R
Roger on Excel
I utilize forms for running an excel spreadsheet.
I have a macro which deletes empty rows (of a specified range). I have it so
the macro works over several sheets.
The macro works fine, however it needs to activate and perform its actions
in each sheet in turn to select the rows and delete them.
I now activate the macro from a userform, and was wondering if there was a
way to execute the code such that the macro doesnt require each sheet to be
activated (ie visible) to work. It is quite distracting having the sheets
scrolling through in the background.
I tried to activate the code with the sheets hidden but the code doesnt work
when I do this.
i have attached the code I use for information. It seems somewhat ungainly
and I wondered if there was a better way to do this without having to have
the sheets visible. I eventually would like all the sheets hidden so the
user doesnt need to access them.
Public Sub DeleteRows()
Dim Rng As Range, Rng1 As Range
Set Rng = Range("A81:E140")
On Error Resume Next
Set Rng1 = Intersect(Rng, Columns("B:B").SpecialCells(xlBlanks))
On Error GoTo 0
If Not Rng1 Is Nothing Then Rng1.EntireRow.Delete
End Sub
Can anyone help or advise me?
Thasnkyou, Roger
I have a macro which deletes empty rows (of a specified range). I have it so
the macro works over several sheets.
The macro works fine, however it needs to activate and perform its actions
in each sheet in turn to select the rows and delete them.
I now activate the macro from a userform, and was wondering if there was a
way to execute the code such that the macro doesnt require each sheet to be
activated (ie visible) to work. It is quite distracting having the sheets
scrolling through in the background.
I tried to activate the code with the sheets hidden but the code doesnt work
when I do this.
i have attached the code I use for information. It seems somewhat ungainly
and I wondered if there was a better way to do this without having to have
the sheets visible. I eventually would like all the sheets hidden so the
user doesnt need to access them.
Public Sub DeleteRows()
Dim Rng As Range, Rng1 As Range
Set Rng = Range("A81:E140")
On Error Resume Next
Set Rng1 = Intersect(Rng, Columns("B:B").SpecialCells(xlBlanks))
On Error GoTo 0
If Not Rng1 Is Nothing Then Rng1.EntireRow.Delete
End Sub
Can anyone help or advise me?
Thasnkyou, Roger