I have the following piece of code which I'd used in a form. However, with this I could only do entry in one worksheet at a time.
The code was,
Sub update_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets(CStr(Worksheets("Data List").Cells(4, 18).Value))
'find first empty row in database
iRow = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
............................
Now, I need to enter the same data inputed into multiple worksheets. Hence, I made the following changes.
Sub update_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rng1, rng2 As Integer
Set rng1 = Worksheets("Data List").Cells(4, 18).Value
Set rng2 = Worksheets("Data List").Cells(9, 18).Value
Set ws = Worksheets(CStr(Worksheets("Data List").Cells(4, 18).Value))
'find first empty row in database
iRow = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
............................
I have all worksheets named as numbers, i.e. 1, 2, 3, 4, etc.
On one worksheet named "Data List" I get the Start Date and End Date.
Obviously the cell value is (4, 18) and (9, 18) is the reference point.
I now wish to run the above code through a loop,
i.e. if I enter Start Date as 5 and End Date as 9, then I need to make the same entry in worksheets 5, 6, 7, 8, 9.
or if the start date is 21 and end date is 30 then I need to make the same data entry in worksheets named, 21, 22, 23, 24, 25, 25
The second piece of code is still been developed, hence not complete.
Please help.
The code was,
Sub update_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets(CStr(Worksheets("Data List").Cells(4, 18).Value))
'find first empty row in database
iRow = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
............................
Now, I need to enter the same data inputed into multiple worksheets. Hence, I made the following changes.
Sub update_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rng1, rng2 As Integer
Set rng1 = Worksheets("Data List").Cells(4, 18).Value
Set rng2 = Worksheets("Data List").Cells(9, 18).Value
Set ws = Worksheets(CStr(Worksheets("Data List").Cells(4, 18).Value))
'find first empty row in database
iRow = ws.Cells(Rows.Count, 2) _
.End(xlUp).Offset(1, 0).Row
............................
I have all worksheets named as numbers, i.e. 1, 2, 3, 4, etc.
On one worksheet named "Data List" I get the Start Date and End Date.
Obviously the cell value is (4, 18) and (9, 18) is the reference point.
I now wish to run the above code through a loop,
i.e. if I enter Start Date as 5 and End Date as 9, then I need to make the same entry in worksheets 5, 6, 7, 8, 9.
or if the start date is 21 and end date is 30 then I need to make the same data entry in worksheets named, 21, 22, 23, 24, 25, 25
The second piece of code is still been developed, hence not complete.
Please help.