I am not sure where to be on creating vba. The workbook has 7 tabs labeled; 9459, 8616, 7471, 0129, 8848, 5649. Each tab (worksheet) needs the name of the tab put in col H (A-G has information). So for tab "9459" I need the number 9459 copied in to every row in col H. I need to do this for each tab.
Next step is to consolidate all seven tabs in to one master tab then a pivot table is created.
I was thinking of setting up an input box for the end user to enter the numbers "9459"...and then the vba would go to that tab do the process. When the user is finished enter each number listed then the input box would finish and the second step would take place.
I have never created input box to do a function. Usually I would create a new tab with control form buttons for the user to go and press for each action above.
What is your advice? I created the code below for the first tab but I can not get the A2 cell to copy down to the last row in col B. Also is there a better way to write this for a total of 7 tabs?
Next step is to consolidate all seven tabs in to one master tab then a pivot table is created.
I was thinking of setting up an input box for the end user to enter the numbers "9459"...and then the vba would go to that tab do the process. When the user is finished enter each number listed then the input box would finish and the second step would take place.
I have never created input box to do a function. Usually I would create a new tab with control form buttons for the user to go and press for each action above.
What is your advice? I created the code below for the first tab but I can not get the A2 cell to copy down to the last row in col B. Also is there a better way to write this for a total of 7 tabs?
VBA Code:
Dim ws As Worksheet
'Set ws = ActiveSheet
For Each ws In ActiveWindow.SelectedSheets
'MsgBox ws.name
Next ws
Dim LastRow As Long
LastRow = Cells(Rows.Count, 2).End(xlUp).Row
Application.ScreenUpdating = False
Sheets("9459").Select
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Selection.NumberFormat = "0"
Range("A1").Select
ActiveCell.FormulaR1C1 = "Rpt No,"
Range("A2").Select
ActiveCell.FormulaR1C1 = "9459"
Range("A2").Select
Selection.Copy
ActiveSheet.Paste
Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row).Value = "9459"
Application.CutCopyMode = False '