jardenp
Active Member
- Joined
- May 12, 2009
- Messages
- 373
- Office Version
- 2019
- 2016
- 2013
- 2011
- 2010
- Platform
- Windows
My copy/paste in the "problem line" below is returning a run time error 1004 Method 'Range' of object '_ Worksheet' failed.
What am I doing wrong? I know that the If statement is true for the first time at row 3045 and that the msgboxes return the correct sheet names when I have those lines uncommented.
Thanks!
What am I doing wrong? I know that the If statement is true for the first time at row 3045 and that the msgboxes return the correct sheet names when I have those lines uncommented.
Thanks!
VBA Code:
Dim OWS As Worksheet
Set OWS = ActiveWorkbook.ActiveSheet
'MsgBox OWS.Name
RowS("1:1").copy
Sheets.Add After:=Sheets(Sheets.Count)
RowS("1:1").Select
ActiveSheet.Paste
ActiveSheet.Name = "AR Transaction Lines"
Dim ARTL As Worksheet
Set ARTL = ActiveWorkbook.ActiveSheet
'MsgBox ARTL.Name
Dim r As Integer 'row counter
Dim s As Integer '"Split" column
s = 11
Dim addrow As Integer 'row counter for adding lines on AR sheet
addrow = 2
For r = 2 To 3047 'OWS.Range("B1000000").End(xlUp).row
If OWS.Cells(r, s) = "1120 · Accounts Receivable" Then
OWS.Range(Cells(r, 1), Cells(r, 13)).copy ARTL.Range(Cells(addrow, 1), Cells(addrow, 13)) '****Problem line****
addrow = addrow + 1
End If
Next r
Last edited by a moderator: