Batteredburrito
New Member
- Joined
- Jul 31, 2018
- Messages
- 15
Hi, i have the following
It inserts a new line based on the Cell value of A30 (referenced as Cell(i,1) or Cell(30,1)
I need to change this to reference the sheet "Essential Info" and Cell G17.
I have learnt how to define ranges but altering a Cell Reference seems a little more tricky
I appreciate the help with this.
Code:
Sub InsertNewBill_Click()
Dim rngCopy As Range
Dim rngPaste As Range
Dim clearCell As Range
If i < 31 Then
i = 31
Cells(30, 1) = i
i = Cells(30, 1) + 1
Cells(30, 1) = i
Else
i = Cells(30, 1) + 1
Cells(30, 1) = i
End If
ActiveSheet.Range("A" & i & ":AD" & i).Insert
Set rngPaste = Range("A" & i & ":AD" & i)
Set rngCopy = ActiveSheet.Range("A" & i - 1 & ":AD" & i - 1)
rngCopy.Copy
rngPaste.PasteSpecial Paste:=xlPasteAll
With ActiveSheet
Cells(i, 1).Clear
End With
Call DeleteTickBoxes_Click
End Sub
It inserts a new line based on the Cell value of A30 (referenced as Cell(i,1) or Cell(30,1)
I need to change this to reference the sheet "Essential Info" and Cell G17.
I have learnt how to define ranges but altering a Cell Reference seems a little more tricky
I appreciate the help with this.