I have a simple macro, but need to add a piece to it that will tell it to paste my data in the next open column, but with the same Row reference each time (same starting point).
For example, if on week 1 the data pastes in Column CU88:CU119, on week 2 I want it to auto paste into Column CV88:CV119, but I don't want to have to manually change "CU" to "CV" to "CW," etc as my weeks progress. I have 4 separate chunks of data that are set to copy/paste, but those ranges per column won't be changing each week, just the actual column it pastes into.
Below is my current macro that is working to paste correctly, but right now I'd have to replace my column reference each week:
Sub ManningOTOnly()
Application.ScreenUpdating = False
Dim excel As excel.Application
Dim wb As excel.Workbook
Dim sht As excel.Worksheet
Dim q As Object
Set q = Application.FileDialog(3)
q.AllowMultiSelect = False
q.Show
Set excel = CreateObject("excel.Application")
Set wb = excel.Workbooks.Open(q.SelectedItems(1))
Set sht = wb.Worksheets("Manning for Quicklooks")
sht.Activate
sht.Range("C3:C51").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU88").PasteSpecial Paste:=xlPasteValues
sht.Activate
sht.Range("D3:D34").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU221").PasteSpecial Paste:=xlPasteValues
sht.Activate
sht.Range("E3:E34").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU337").PasteSpecial Paste:=xlPasteValues
sht.Activate
sht.Range("F3:F34").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU453").PasteSpecial Paste:=xlPasteValues
Application.ScreenUpdating = True
wb.Close
End Sub
Thank you for your help!
For example, if on week 1 the data pastes in Column CU88:CU119, on week 2 I want it to auto paste into Column CV88:CV119, but I don't want to have to manually change "CU" to "CV" to "CW," etc as my weeks progress. I have 4 separate chunks of data that are set to copy/paste, but those ranges per column won't be changing each week, just the actual column it pastes into.
Below is my current macro that is working to paste correctly, but right now I'd have to replace my column reference each week:
Sub ManningOTOnly()
Application.ScreenUpdating = False
Dim excel As excel.Application
Dim wb As excel.Workbook
Dim sht As excel.Worksheet
Dim q As Object
Set q = Application.FileDialog(3)
q.AllowMultiSelect = False
q.Show
Set excel = CreateObject("excel.Application")
Set wb = excel.Workbooks.Open(q.SelectedItems(1))
Set sht = wb.Worksheets("Manning for Quicklooks")
sht.Activate
sht.Range("C3:C51").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU88").PasteSpecial Paste:=xlPasteValues
sht.Activate
sht.Range("D3:D34").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU221").PasteSpecial Paste:=xlPasteValues
sht.Activate
sht.Range("E3:E34").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU337").PasteSpecial Paste:=xlPasteValues
sht.Activate
sht.Range("F3:F34").Offset(0, 0).Copy
Sheets("Raw Data").Range("CU453").PasteSpecial Paste:=xlPasteValues
Application.ScreenUpdating = True
wb.Close
End Sub
Thank you for your help!