matrix
New member
Hello Excel World. Below I have a code that copies different cells data and transfers and paste data from one worksheet into multiple worksheets base on the cells reference names.
My problem here is this. Each worksheets have tables that (SHOULD GRAB) the new data that is paste automatically below the table, which overtime it creates an historical data and automatically update the column chart for each table.
How can I make adjustments to the code below that supports my request?
Thanks in advance
Cheers
My problem here is this. Each worksheets have tables that (SHOULD GRAB) the new data that is paste automatically below the table, which overtime it creates an historical data and automatically update the column chart for each table.
How can I make adjustments to the code below that supports my request?
Thanks in advance
Cheers
Code:
[COLOR=#0000FF][FONT=inherit]Sub[/FONT][/COLOR][COLOR=#141414][FONT=inherit] Update_Sheets[/FONT][/COLOR][COLOR=#141414][FONT=inherit]([/FONT][/COLOR][COLOR=#141414][FONT=inherit])[/FONT][/COLOR]
[COLOR=#0000FF]Dim[/COLOR] sh1 [COLOR=#0000FF]As[/COLOR] Worksheet, sh2 [COLOR=#0000FF]As[/COLOR] Worksheet
[COLOR=#0000FF]Dim[/COLOR] i [COLOR=#0000FF]As[/COLOR] [COLOR=#0000FF]Long[/COLOR], j [COLOR=#0000FF]As[/COLOR] [COLOR=#0000FF]Long[/COLOR], f [COLOR=#0000FF]As[/COLOR] Range
[COLOR=#0000FF]Set[/COLOR] sh1 = Sheets([COLOR=#E29232]"Debt_to_GDP"[/COLOR])
[COLOR=#0000FF]For[/COLOR] i = [COLOR=#C92C2C]2[/COLOR] [COLOR=#0000FF]To[/COLOR] sh1.Range([COLOR=#E29232]"A:A"[/COLOR]).Find([COLOR=#E29232]"*"[/COLOR], , xlValues, , xlByRows, xlPrevious).Row
[COLOR=#0000FF]Set[/COLOR] sh2 = Sheets(Replace(sh1.Range([COLOR=#E29232]"A"[/COLOR] & i).Value, [COLOR=#E29232]" "[/COLOR], [COLOR=#E29232]"_"[/COLOR]))
[COLOR=#0000FF]Set[/COLOR] f = sh2.Range([COLOR=#E29232]"B:B"[/COLOR]).Find(sh1.Range([COLOR=#E29232]"B"[/COLOR] & i).Value, , xlFormulas, xlWhole)
[COLOR=#0000FF]If[/COLOR] f [COLOR=#0000FF]Is[/COLOR] [COLOR=#C92C2C]Nothing[/COLOR] [COLOR=#0000FF]Then[/COLOR]
j = sh2.Range([COLOR=#E29232]"B:B"[/COLOR]).Find([COLOR=#E29232]"*"[/COLOR], , xlValues, , xlByRows, xlPrevious).Row + [COLOR=#C92C2C]1[/COLOR]
sh2.Range([COLOR=#E29232]"B"[/COLOR] & j).Value = sh1.Range([COLOR=#E29232]"B"[/COLOR] & i).Value
sh2.Range([COLOR=#E29232]"C"[/COLOR] & j).Value = sh1.Range([COLOR=#E29232]"C"[/COLOR] & i).Value
[COLOR=#0000FF]End[/COLOR] [COLOR=#0000FF]If[/COLOR]
[COLOR=#0000FF]Next[/COLOR] [COLOR=#0000FF][FONT=inherit]End[/FONT][/COLOR][COLOR=#0000FF][FONT=inherit]Sub[/FONT][/COLOR]