Hello!
I'm trying to create a Macro to do some row formatting, for clarity, it's formatting for design not numbers/formulas.
I started a thread here Link, but was directed to post here, I hope anyone can help.
Originally, I thought I could just use the macro recorder format my cells and save, next time I wanted to format the 4 rows it would be as simple as CTRL+Q..
of course that would've been to easy it didn't work I couldn't get it to skip the rows I wanted blank (original macro recording is on the link above sorry I didn't use the code tag).
Then I changed my way of thinking and thought, If I put the format style at the top of the page (then hide the rows), it should be easy to record a macro that copies and pastes those cells/rows to the current location. And sure with a minor modification and google searching I was right! I came up with a simple line as
Worked great!, but if I soon realized I needed to put items between other previously pasted items, so following the same logic I recorded another with an insert function instead of paste.. Below is what was recorded, Rows("18:18").Select has no signifigant relivance other than it's the row I chose to insert my formatting, it could've been any row and any point in the document.
I hope that is enough detail. Thanks for any help!
~AZ
I'm trying to create a Macro to do some row formatting, for clarity, it's formatting for design not numbers/formulas.
I started a thread here Link, but was directed to post here, I hope anyone can help.
Originally, I thought I could just use the macro recorder format my cells and save, next time I wanted to format the 4 rows it would be as simple as CTRL+Q..
of course that would've been to easy it didn't work I couldn't get it to skip the rows I wanted blank (original macro recording is on the link above sorry I didn't use the code tag).
Then I changed my way of thinking and thought, If I put the format style at the top of the page (then hide the rows), it should be easy to record a macro that copies and pastes those cells/rows to the current location. And sure with a minor modification and google searching I was right! I came up with a simple line as
Code:
Sub New_Safety_Item()
'
' New_Safety_Item Macro
' Add New Safety Item
'
' Keyboard Shortcut: Ctrl+q
'
Range("A1:C4").Copy Destination:=Cells(ActiveCell.Row + 1, 1)
End Sub
Worked great!, but if I soon realized I needed to put items between other previously pasted items, so following the same logic I recorded another with an insert function instead of paste.. Below is what was recorded, Rows("18:18").Select has no signifigant relivance other than it's the row I chose to insert my formatting, it could've been any row and any point in the document.
Code:
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+p
'
Rows("1:4").Select
Selection.Copy
Rows("18:18").Select
Selection.Insert Shift:=xlDown
End Sub
I hope that is enough detail. Thanks for any help!
~AZ