J
Jim Berglund
Running the following code yields a 1004 error at the noted line. I've tried everything I can think of - any ideas, please?
Option Explicit
Sub Create_Telephone_List()
Dim i, k, m As Long
Dim n, j As Integer
Dim s, r, t, u, v, w, x As String
Dim ws1, ws2 As Worksheet
Application.ScreenUpdating = False
Set ws1 = Sheets("Telephone List")
Set ws2 = Sheets("Telephone Directory")
k = 0 'Locater Row for paste
n = 1 'Column number
For i = 1 To 26
ws1.Activate
ws1.Cells(3, n).Select
j = ActiveCell.CurrentRegion.Rows.Count 'number of rows
ws1.Range(Cells(2, n), Cells(j + 3, n + 1)).Select 'ERROR 1004
Selection.Copy
ws2.Select
k = k + j + 1
Cells(k, 1).Select
ActiveSheet.Paste
n = n + 3
Next
End Sub
Thanks,
Jim Berglund
Option Explicit
Sub Create_Telephone_List()
Dim i, k, m As Long
Dim n, j As Integer
Dim s, r, t, u, v, w, x As String
Dim ws1, ws2 As Worksheet
Application.ScreenUpdating = False
Set ws1 = Sheets("Telephone List")
Set ws2 = Sheets("Telephone Directory")
k = 0 'Locater Row for paste
n = 1 'Column number
For i = 1 To 26
ws1.Activate
ws1.Cells(3, n).Select
j = ActiveCell.CurrentRegion.Rows.Count 'number of rows
ws1.Range(Cells(2, n), Cells(j + 3, n + 1)).Select 'ERROR 1004
Selection.Copy
ws2.Select
k = k + j + 1
Cells(k, 1).Select
ActiveSheet.Paste
n = n + 3
Next
End Sub
Thanks,
Jim Berglund