Forum Discussion
JDexcelNEW
Jan 10, 2025Copper Contributor
Multiple unique cells copied to separate workbook
Hello, I am trying to create a macro or button that will take data or text from multiple cells (example C4,E6,G6) and copy that data to another workbook, this would not be so difficult normally howe...
HansVogelaar
Jan 10, 2025MVP
See if you can use this as starting point.
Sub Test()
Dim wsS As Worksheet
Dim wbT As Workbook
Dim wsT As Worksheet
Dim stM As String
Set wsS = ActiveSheet
Set wbT = Workbooks("Data arc.xlsx") ' or Workbooks.Open("...\Data arc.xlsx")
stM = Format(wsS.Range("C5").Value, "mmm")
Set wsT = wbT.Worksheets(stM)
wsT.Range("A" & wsT.Rows.Count).End(xlUp).Offset(1).Value = wsS.Range("C4").Value
wsT.Range("M" & wsT.Rows.Count).End(xlUp).Offset(1).Value = wsS.Range("E6").Value
' etc.
End Sub
JDexcelNEW
Jan 11, 2025Copper Contributor
Thank you, I think i can get it to work with this.