M
magmike
I just upraded from Excel 2003 to Excel 2010. Previously, the code below took a template row with formulas and conditional formatting and inserted a copy of it above the currently selected row inside a defined table. However,now, the conditional formatting doesn't carry over.
If I do this manually, by inserting a row first, then copying the template row (located on another sheet in the workbook) and the paste it over the newly inserted row, then it acts correctly.
Can someone help me modify the followomg code to mimick doing it manually or tell me what is wrong with mine?
Sub Nsert_TemplateRow()
Dim Msg, Style, Title, Response
Msg = "This will insert a New Row ABOVE your currently selected cell. Do you wish to continue?"
Style = vbYesNo + vbInformation
Title = "Insert Row"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
If Selection.Column = 1 Then
Range("New_Row").Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Else
MsgBox "You must first select a cell in column A", vbInformation, Title
End If
Else
'anything else
End If
End Sub
Thanks in advance for your help,
magmike
If I do this manually, by inserting a row first, then copying the template row (located on another sheet in the workbook) and the paste it over the newly inserted row, then it acts correctly.
Can someone help me modify the followomg code to mimick doing it manually or tell me what is wrong with mine?
Sub Nsert_TemplateRow()
Dim Msg, Style, Title, Response
Msg = "This will insert a New Row ABOVE your currently selected cell. Do you wish to continue?"
Style = vbYesNo + vbInformation
Title = "Insert Row"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
If Selection.Column = 1 Then
Range("New_Row").Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Else
MsgBox "You must first select a cell in column A", vbInformation, Title
End If
Else
'anything else
End If
End Sub
Thanks in advance for your help,
magmike