Forum Discussion
_Random_Excel_User_
Sep 16, 2022Copper Contributor
VBA code help needed
Hello, I have been trying to figure out a simpler way to copy information over from one worksheet that the data changes on daily, over to another worksheet that compiles the information for each day ...
HansVogelaar
Sep 16, 2022MVP
You have B10 twice. Shouldn't the second one be B20 or B21? If so, change the code below accordingly.
Sub CopyData()
Dim ws As Worksheet
Dim wt As Worksheet
Dim r As Long
Dim aRows As Variant
Dim aCols As Variant
Dim i As Long
Application.ScreenUpdating = False
aRows = Array(4, 9, 10, 11, 12, 13, 15, 17, 18, 19, 10, 22, 23, 24, 26)
aCols = Array("B", "H", "I", "J", "K", "L", "M", "O", "P", "Q", "R", "AA", "AC", "AD", "AF")
Set ws = Worksheets("Chemical Calculator")
Set wt = Worksheets("September")
r = wt.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
For i = LBound(aRows) To UBound(aRows)
wt.Range(aCols(i) & r).Value = ws.Range("B" & aRows(i)).Value
Next i
Application.ScreenUpdating = True
End Sub_Random_Excel_User_
Sep 16, 2022Copper Contributor
Wow, that looks so confusing, I wish I could understand the coding language more.
I will try it now. Thank you so much, I will update you once I try it!
I will try it now. Thank you so much, I will update you once I try it!