I can't seem to get something so simple to work in excel VBA
I have data on cell A1
Sub TestBox()
ActiveSheet.Activate
MsgBox (Cells(0, 0).Value)
End Sub
I want to output said data using basically a msgBox
Run-time error:'1004' Application -defined or object-defined error
ActiveSheet.Activate? By definition, theActiveSheetis the one that is active, so that seems to be a pointless piece of code.Dim ws As Worksheet: Set ws = ActiveSheetand then useMsgBox ws.Cells(1, 1).Value. If you don't, the user could change the active sheet between when you set the active sheet to be the active sheet and when theMsgBoxis displayed.