Excel VBA to copy data, open notepad & paste, then copy and paste back to excel
I am admittedly a novice at VBA. I have a need to copy a row of excel data (dates) and copy them, then open up notepad, and paste the data. Then I need to select all from notepad and copy. Then I would like to close notepad, and paste the data back into excel. I am close, but cannot quite figure out how to focus back to excel and close notepad...
Shell "notepad.exe", vbMaximizedFocus
If Application.CutCopyMode = False Then
MsgBox "clipboard empty"
MsgBox "Copied Times to Notepad and now Pasting back to Excel"
'now activate excel window
Application.Workbooks("working daily excel with macros").Activate
Sheets("Average Start Time data").Select
MsgBox "Now you can close notepad"
Re: Excel VBA to copy data, open notepad & paste, then copy and paste back to excel
I would absolutely love to find another way around this anomoly, but basically, I have a row of dates exported from another application. Some of the dates are null or blank, but most have data. I have tried every type of code recommended by the best programmers, but there was nothing I could do to avoid the div/0 error. I found that if I copied and pasted the data into another simple application (like notepad or vi) and copied the data back to excel, the averages worked. It's the strangest thing ever...
All I really need to do from the code that I have is close the notepad application that I have already opened, and bring the excel window back to focus. It doesn't seem to work for some reason...