View Single Post
  #1   Report Post  
GarToms GarToms is offline
Member
 
Posts: 33
Default Combining macros

Hi all,

I'm looking to merge 2 macros in one so they both activate when i select a button. The macro code is as follows, the first needs to occur first.

MACRO 1:
Sub RemoveFormulasDeleteRows()
'
' RemoveFormulasDeleteRows Macro
' Macro recorded 19/01/2006 by Corus
'

'
Range("A14:R71").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("C16").Select
End Sub

MACRO 2
Function RowIsEmpty(n As Double) As Boolean
If Cells(n, 1).Value = "" And Cells(n, 1).End(xlToRight).Value = "" Then _
RowIsEmpty = True Else RowIsEmpty = False
End Function
Sub HideEmptyRows()
Dim tableEnd As Double
Dim m As Double

'tableEnd is set to the last row in the spreadsheet.
'work backwards from the last row upwards and hide the row if it is empty.

tableEnd = Range("a1").SpecialCells(xlCellTypeLastCell).Row
For m = tableEnd To 1 Step -1
If RowIsEmpty(m) Then Cells(m, 1).EntireRow.Hidden = True
Next m
End Sub

Any help with this would be appreciated.

Toms