Hi All.. I'm not very good at macros or vba, pls keep this in mind while reading my issue.
In the view code section of a tab in my sheet, I have the code as per the screenshot below. These codes operate via a button on the sheet. I want to get rid of the button and just use a link to trigger a macro that does same thing. (which I know how to do).
My issue is that I don't know how to do this. i.e (i want the following to be a named macro).. Hope this question makes sense
Private Sub CommandButton2_Click()
Workbooks.Open "C:\CSVToday\1a.csv"
Workbooks("1a.csv").Sheets("1a").Range("A4:G2000").Copy
ThisWorkbook.Sheets("TodaysData").Range("C4").PasteSpecial Paste:=xlPasteValues
ActiveWindow.WindowState = xlMinimized
MsgBox ("Data Has Been Updated")
In the view code section of a tab in my sheet, I have the code as per the screenshot below. These codes operate via a button on the sheet. I want to get rid of the button and just use a link to trigger a macro that does same thing. (which I know how to do).
My issue is that I don't know how to do this. i.e (i want the following to be a named macro).. Hope this question makes sense
Private Sub CommandButton2_Click()
Workbooks.Open "C:\CSVToday\1a.csv"
Workbooks("1a.csv").Sheets("1a").Range("A4:G2000").Copy
ThisWorkbook.Sheets("TodaysData").Range("C4").PasteSpecial Paste:=xlPasteValues
ActiveWindow.WindowState = xlMinimized
MsgBox ("Data Has Been Updated")