L
Larry
I have the following code, I know there has to be some way to improve on it.
I would greatly appreciate it if someone would give me some guidance on it.
Thanks in advance and here is what code I have.
Sub test()
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range, rng4 As Range
Dim rng5 As Range, rng6 As Range, rng7 As Range, rng8 As Range
Dim rng9 As Range, rng10 As Range, rng11 As Range, rng12 As Range
Dim rng13 As Range, rng14 As Range
Dim wb1 As Workbook
Set wb1 = Workbooks.Open("c:\Inventory\xlWorkFile\xlMasterFile")
Set rng1 = wb1.Worksheets("txtMaster").Range("C1:C1500")
Set rng2 = wb1.Worksheets("txtMaster").Range("F1:F1500")
Set rng3 = wb1.Worksheets("txtMaster").Range("G1:G1500")
Set rng4 = wb1.Worksheets("txtMaster").Range("I1:I1500")
Set rng5 = wb1.Worksheets("txtMaster").Range("J1:J1500")
Set rng6 = wb1.Worksheets("txtMaster").Range("K1:K1500")
Set rng7 = wb1.Worksheets("txtMaster").Range("M1:M1500")
Set rng8 = Workbooks("Book2").Sheets("Sheet1").Range("B3")
Set rng9 = Workbooks("Book2").Sheets("Sheet1").Range("C3")
Set rng10 = Workbooks("Book2").Sheets("Sheet1").Range("D3")
Set rng11 = Workbooks("Book2").Sheets("Sheet1").Range("E3")
Set rng12 = Workbooks("Book2").Sheets("Sheet1").Range("F3")
Set rng13 = Workbooks("Book2").Sheets("Sheet1").Range("G3")
Set rng14 = Workbooks("Book2").Sheets("Sheet1").Range("H3")
rng1.Copy rng8
rng2.Copy rng9
rng3.Copy rng10
rng4.Copy rng11
rng5.Copy rng12
rng6.Copy rng13
rng7.Copy rng14
End Sub
I would greatly appreciate it if someone would give me some guidance on it.
Thanks in advance and here is what code I have.
Sub test()
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range, rng4 As Range
Dim rng5 As Range, rng6 As Range, rng7 As Range, rng8 As Range
Dim rng9 As Range, rng10 As Range, rng11 As Range, rng12 As Range
Dim rng13 As Range, rng14 As Range
Dim wb1 As Workbook
Set wb1 = Workbooks.Open("c:\Inventory\xlWorkFile\xlMasterFile")
Set rng1 = wb1.Worksheets("txtMaster").Range("C1:C1500")
Set rng2 = wb1.Worksheets("txtMaster").Range("F1:F1500")
Set rng3 = wb1.Worksheets("txtMaster").Range("G1:G1500")
Set rng4 = wb1.Worksheets("txtMaster").Range("I1:I1500")
Set rng5 = wb1.Worksheets("txtMaster").Range("J1:J1500")
Set rng6 = wb1.Worksheets("txtMaster").Range("K1:K1500")
Set rng7 = wb1.Worksheets("txtMaster").Range("M1:M1500")
Set rng8 = Workbooks("Book2").Sheets("Sheet1").Range("B3")
Set rng9 = Workbooks("Book2").Sheets("Sheet1").Range("C3")
Set rng10 = Workbooks("Book2").Sheets("Sheet1").Range("D3")
Set rng11 = Workbooks("Book2").Sheets("Sheet1").Range("E3")
Set rng12 = Workbooks("Book2").Sheets("Sheet1").Range("F3")
Set rng13 = Workbooks("Book2").Sheets("Sheet1").Range("G3")
Set rng14 = Workbooks("Book2").Sheets("Sheet1").Range("H3")
rng1.Copy rng8
rng2.Copy rng9
rng3.Copy rng10
rng4.Copy rng11
rng5.Copy rng12
rng6.Copy rng13
rng7.Copy rng14
End Sub