Forum Discussion

Mark1357's avatar
Mark1357
Copper Contributor
Jan 19, 2023

Macro to send input rows of data from dashboard to update/add to a data sheet.

Hi all, 

Still quite new to macros and I am having difficulty creating one that sends data from one tab (titled "Input") to the "Data" tab.

 

Ideally, the macro would be able to take the data from the "Input" (first image), and send it to "Data" (second image) either replacing existing data (using Shape in column A as the reference) or adding the new shape and attributes. 

 

Essentially, it would need to function as the example below. (the highlighted cells showing new or updated data)

 

 

 

 

 

 

​

 

 

Currently, my macro is only able to take the top row from the "Input" sheet and send it to the "Data" sheet.

It is unable to send multiple rows, or replace any of the 'Shape' attributes. 

 

 

  

 

 

Sub Input_Button()

Dim sourceSheet As Worksheet

Dim dataSheet As Worksheet

Dim nextRow As Long

Set sourceSheet = Sheets("Input")

Set dataSheet = Sheets("Data")

nextRow = dataSheet.Range("A" & dataSheet.Rows.Count).End(xlUp).Offset(1).Row

dataSheet.Cells(nextRow, 1).Value = sourceSheet.Range("B2").Value

dataSheet.Cells(nextRow, 2).Value = sourceSheet.Range("C2").Value

dataSheet.Cells(nextRow, 3).Value = sourceSheet.Range("D2").Value

 

sourceSheet.Range("B2:B200").Value = ""

sourceSheet.Range("C2:C200").Value = ""

sourceSheet.Range("D2:D200").Value = ""

End Sub

 

Please let me know if you can help.

 

Thanks you so much!

No RepliesBe the first to reply

Resources