acharsanthosh
New Member
- Joined
- Dec 20, 2017
- Messages
- 9
Hello Folks,
I do have a report with around 45 sheets and A table data in the last sheet Naming "Other Data"
Other data table has all the sheet names and am running for each based on this sheet names.
Now I want to run the 'for each' to update C4 value in each sheet based on the table in "Other Data" in the column C has data for all 45 sheets
For example sheet1 C4 should be C2 of "Other data", sheet2 C4 should be C3 of "Other data",sheet3 C4 should be C4 of "Other data"........like this for all the sheets.
Below is the Code which I prepared and it is updating the C2 value in all the table
Sub For each
Dim Rng As Range, Dn As Range, R As Range, ShtRng As Range
With Sheets("Other Data")
Set Rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
End With
For Each Dn In Rng
With Sheets(Dn.Value)
Set ShtRng = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
For Each R In ShtRng
R.Range("C5") = Sheets("Other Data").Range("C4")
Next R
End With
Next Dn
End Sub
Kindly Help !!!
I do have a report with around 45 sheets and A table data in the last sheet Naming "Other Data"
Other data table has all the sheet names and am running for each based on this sheet names.
Now I want to run the 'for each' to update C4 value in each sheet based on the table in "Other Data" in the column C has data for all 45 sheets
For example sheet1 C4 should be C2 of "Other data", sheet2 C4 should be C3 of "Other data",sheet3 C4 should be C4 of "Other data"........like this for all the sheets.
Below is the Code which I prepared and it is updating the C2 value in all the table
Sub For each
Dim Rng As Range, Dn As Range, R As Range, ShtRng As Range
With Sheets("Other Data")
Set Rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
End With
For Each Dn In Rng
With Sheets(Dn.Value)
Set ShtRng = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
For Each R In ShtRng
R.Range("C5") = Sheets("Other Data").Range("C4")
Next R
End With
Next Dn
End Sub
Kindly Help !!!