Open, then immediately close Userform?

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
801
Office Version
  1. 365
Platform
  1. Windows
I've been googling this everywhere but can't find anything helpful.

In my sub I have something like

Load.AdSelect

AdSelect is a userform that pops up, and all I want it to do is to open AdSelect then close it straight away with no dialogue.

Basically, it selects a cell, A3, opens AdSelect, then closes it. I then want it to go to A4 and open AdSelect then close it, etc etc.

Thanks.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Load.AdSelect

Does not work for me.

AdSelect.show works for me

Explain what happens when this Userform Opens
Do you have a sheet initialization script that does something?

There is surely another way to do things.

What is your ultimate goal here?
 
Last edited:
Upvote 0
Sub Full_Out_Gen()
'
' Full_Out_Gen Macro
'


'
Do Until Cells(ActiveCell.Row, "A").Value = ""
Range("A3").Select
Load AdSelectkill
AdSelectkill.Show
ActiveCell.Offset(1, 0).Activate
Loop
End Sub



This is what I have so far but it's not actually going down a row. It opens the AdSelect panel for the initial cell (A3) then closes it automatically after 2 seconds, but it's not going to A4 then repeating then A5 etc.
 
Upvote 0
I'm not familiar with what Load does.
And in most scripting it's not a good practice to use Active cell

Are you wanting to go down Column A starting in row 3 and keep going to last cell in column A with data?
And I see nothing here that keeps the Userform open for 2 seconds.

I assume your wanting some message to popup on the screen stay displayed for 2 seconds and Keep going on and on till lastrow in column A with data.

What if anything causes the message to change?
 
Upvote 0
Got it:

Sub Full_Out_Gen()
'
' Full_Out_Gen Macro
'


'
Range("A3").Select
Do Until Cells(ActiveCell.Row, "A").Value = ""
If Cells(ActiveCell.Row, "F").Value = "Company" Then
Load AdSelect
AdSelect.Show
End If
ActiveCell.Offset(1, 0).Activate
Loop
End Sub




In the AdSelect Panel, I used this code:

Private Sub UserForm_Activate()
Application.Wait (Now + TimeValue("0:00:01"))

Unload Me
End Sub


The AdSelect panel opens for 1 second, closes, goes down a row in the A column and bases it whether the F column has "Company" in.

Then it opens that, closes it, goes to next one. Perfection!
 
Upvote 0
Here is how I would do it:
Code:
Sub MyWay()
'Modified  8/31/2018  12:57:19 PM  EDT
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 3 To Lastrow
        If Cells(i, "F").Value = "Company" Then
            Load adselect
            adselect.Show
        End If
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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