Help with a short Macro

Dan Wilson

Well-known Member
Joined
Feb 5, 2006
Messages
546
Office Version
  1. 365
Platform
  1. Windows
Good day. I have a Macro that is working, but it needs one more step that I don't know how to do. The Macro below prints out either "Done" or "Failed" upon completion. When it prints out one of those words, the word is enclosed in a box labeled Microsoft Excel and it requires that I either select the "OK" button or hit the Return key to close it and move on. Is there a way to print out the words without having to follow up with another action? I appreciate any help with this.

VBA Code:
Sub Copy_Random_Numbers()
' 12/8/2024
' Copy_Random_Numbers Macro
' Copy random numbers and check for bad
'
Application.ScreenUpdating = falsemsg = "Sorry - failed"
For try = 1 To 3000
'
Range("a4:an4") = Range("a3:an3").Value
If Range("R14") = 0 Then
    msg = "Done"
    GoTo done
End If
Next try
Range("a6").Select
msg = "Failed"
'
done:
Application.ScreenUpdating = True
MsgBox msg
'
End Sub

Thank you,
Dan Wilson...
 
Last edited by a moderator:
I have no idea how to use the Code Tags. If you can point me in the right direction
I thought that I already did. ;)
My signature block below has more details.
.. and in my signature block below is ..
1733791312448.png
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Dan. I have removed the "Mark as solution" from my post #11 as clearly it isn't a solution to your original question. If one of the other posts in the thread does answer your original question then you can mark that as the solution post. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,337
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top