cc11
New Member
- Joined
- Apr 6, 2021
- Messages
- 48
- Office Version
- 365
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Can someone please help!!!
I am needing to find a code or rewrite mine so that when I press the assigned macro button it will generate a new row below the one that is above it.
This is the code that I have.
Sub NEWSUBMITTALCOVER()
'
' NEWSUBMITTALCOVER Macro
' *Create a new submittal
'
' Keyboard Shortcut: Ctrl+Shift+H
'
Dim lr As Long
Dim ws As String
' Create new sheet
Sheets("Submittal Cover (0)").Select
Sheets("Submittal Cover (0)").Copy After:=Sheets(2)
' Get name of new sheet
ws = ActiveSheet.Name
' Find last row with data in column A (Totals row)
Sheets("Submittal Cover Log").Select
lr = Cells(Rows.Count, "A").End(xlUp).Row
' Insert new row
Rows(lr).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
' Insert formulas
Range("A" & lr).FormulaR1C1 = "='" & ws & "'!R2C1"
Range("B" & lr).FormulaR1C1 = "='" & ws & "'!R5C1"
Range("C" & lr).FormulaR1C1 = "='" & ws & "'!R3C1"
Range("D" & lr).FormulaR1C1 = "='" & ws & "'!R7C1"
Range("E" & lr).FormulaR1C1 = "='" & ws & "'!R4C1"
Range("F" & lr).FormulaR1C1 = "='" & ws & "'!R2C3"
End Sub
@Joe4 you helped me with my last one if you could help me again I would really appreciate it! It is similar to the one we did yesterday.
I am needing to find a code or rewrite mine so that when I press the assigned macro button it will generate a new row below the one that is above it.
This is the code that I have.
Sub NEWSUBMITTALCOVER()
'
' NEWSUBMITTALCOVER Macro
' *Create a new submittal
'
' Keyboard Shortcut: Ctrl+Shift+H
'
Dim lr As Long
Dim ws As String
' Create new sheet
Sheets("Submittal Cover (0)").Select
Sheets("Submittal Cover (0)").Copy After:=Sheets(2)
' Get name of new sheet
ws = ActiveSheet.Name
' Find last row with data in column A (Totals row)
Sheets("Submittal Cover Log").Select
lr = Cells(Rows.Count, "A").End(xlUp).Row
' Insert new row
Rows(lr).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
' Insert formulas
Range("A" & lr).FormulaR1C1 = "='" & ws & "'!R2C1"
Range("B" & lr).FormulaR1C1 = "='" & ws & "'!R5C1"
Range("C" & lr).FormulaR1C1 = "='" & ws & "'!R3C1"
Range("D" & lr).FormulaR1C1 = "='" & ws & "'!R7C1"
Range("E" & lr).FormulaR1C1 = "='" & ws & "'!R4C1"
Range("F" & lr).FormulaR1C1 = "='" & ws & "'!R2C3"
End Sub
@Joe4 you helped me with my last one if you could help me again I would really appreciate it! It is similar to the one we did yesterday.