Wait For User Verification VBA
Jan 6, 2014
how do I code in vba for it to wait until the user has checked the file that has been made make a few amendments and then when done one would click OK or resume for the program to carry on with the rest of the code.
View 2 Replies
ADVERTISEMENT
Mar 5, 2008
I'm trying to write what is supposed to be a simple script that looks at a column of usernames (ColumnA) and passwords (ColumnB). I start off by prompting the user to enter their username in an input box and then I want a loop to check this value against the values in Column A. If the username exists, I want to prompt an input box for the password. If the username does not exist I need some kind of limit on the loop to prompt an input box for the user to enter a new username and password that I'll add to the last row of the data table. The loop part is kicking my butt, this is what I have so far...
Sub Main()
Set StartRange = Worksheets("16.10"). Range("A1")
username = InputBox("Please enter your username.", "Enter username", "Jdoe")
i = 1
Do While StartRange.Offset(i, 0).Value <> "username"
i = i + 1
Loop
If StartRange.Offset(i, 0).Value = "username" Then
password = InputBox("Please enter your password.", "Enter password", "password")
End If
End Sub
View 7 Replies
View Related
Jan 24, 2014
How do I pause my macro until the user selects a chart in the worksheet? Or Keep prompting a message to the user till he selects the chart and when a chart is selected run the macro.
Step 1: Check if a chart is Selected
Step 2: If yes, run the macro
Step 3: If no, prompt the user with a msgbox of Retry/Cancel.
Step 4: If the user selects Retry, wait till he makes a selection.
Step 5: If the selection is a chart, run the macro. If the selection is not a chart prompt the same msgbox again and keep looping it till he selects a chart.
Sub test5()
Dim chtSelected As Chart
Dim UserResponse As Integer
On Error Resume Next
Set chtSelected = ActiveChart
[Code] .....
View 2 Replies
View Related
Feb 15, 2010
I would like to add a piece of code into the user form that will check and verify if a part has already been added so as to avoid multiples in a user-driven/created database.
here is a repost of the current code i am using for the user form (I have posted it before in another thread .. Blane245 helped me out with a different question I had)
View 7 Replies
View Related
Jan 15, 2014
I have a macro where I manually select a cell then the macro kicks in to copy and paste the contents into the Find function. From there it goes to another work sheet, clicks on a cell in column one and searches for matching cell contents. Then If false it manually goes back to the original worksheet/cell and then I input a N in the left adjacent cell. If true I enter a Y. Right now I can only run this for the specific cell the macro was recorded for. I would like to expand this.
What I would like to do create a loop in the macro that waits for my cell choice input then continues with the with the Find function. If false the macro should just loop back to the original worksheet/cell and wait for input, ie the next cell selected. However, if true a worksheet/cell is selected, a Y is input and it loops back to the original cell and waits for input.
View 9 Replies
View Related
Feb 21, 2013
In the following code snippet I have worked out a way to verify that the user inputs an Integer and then prompts downstream if an improper value was entered. The user is prompted for a corrected reponse and loops until they get it right. The initial Cancel at the first prompt was causing issues until i saw poster: titarelli use StrPtr(). Except for subsequent cancels, the code works but it is clunky at best. How to tighten this up?
VB:
Dim Quantity As Variant
Dim CorrectedQuantity As Variant
Dim j As Integer
j = 194
Quantity = 0
CorrectedQuantity = 0
[Code] ......
View 2 Replies
View Related
Jun 3, 2008
I have a VBA userform with various textbox fields like 'Name' and 'Address' and 'Amount'
I would like an input box to pop up that asks the user to 're-enter for verification'
So that they have to type the same thing twice, to protect against typos
How do I code it so the program compares the inputbox to the textbox and passes only if they are identical?
(or even, using two inputboxes instead if that would be easier)
View 13 Replies
View Related
Apr 6, 2008
i have followed the following criteria correctly
Create a function GetProducerRow() which takes in one String input (give it any name following the conventions) and returns an Integer.
Write a Select Case statement inside the function.It should compare the input string with the various companies listed in the Voting tables in cells F5:F9.
The Case should not use hard coded values for the names of the companies but something like Range("F5").Value.
In each case, set the return value by assigning the appropriate row number. For example, the value assigned would be 5 for "The Hershey Company" store in F5.
Remember to write Case statement for each of the 5 producers.
Add the Case Else in-case none of the producers match the input and have the return value set to 0.
Function GetProducerRow(strProducer As String) As Integer
strProducer = Range("F5")
Select Case strProducer
View 9 Replies
View Related
Jul 19, 2008
I am trying to check what was selected from a validation list range. I need to put up a message box if a certain selection is made. I will try to give some more explaination and detail.
I have a 'Labor Type' cell that has a validation list based on the 'LaborType' range that contains things like T&M, PM, Claim*, Quote, etc. When Claim* is selected, I want to put up the message box reminding the user to enter some additional information.
I have tried a few things like Worksheet_SelectionChange that I can't seem to get to work. I admit it has been a while since I have used a function like this (and never with a list).
View 9 Replies
View Related
Jun 29, 2013
I started a new collection of cards (soccer cards actually) and since I trade with some of my friends via mail, I needed something to keep track of the ones I have and the ones I don't. I made an excel spreadsheet with the numbers of the cards.
Here's my question (I don't know if its possible or not):
I there any way I can create a way to make the verification easier by, for example:
I just got card A20. I write A20 on a specific cell and, in the main table, that number changes color to indicate that I already have that card.
And in the end, a way to reverse the process so I can have the table brand new for the next use.
View 1 Replies
View Related
Jun 26, 2014
Just curious if there is a way to do some sort of Data Validation form that will check the previous selection and remove it from a list for the next selection? I have several machines that my company sells and I am working on an advanced invoice. I am trying to set it up so that if one machine is selected, it will populate the data validation boxes with one set of "options" for that particular machine. Also, when the user clicks on one option, no matter which one, it will remove that option from the list below it. I have posted up somewhat of a screenshot/crop/paste example of what I am attempting to do.
View 1 Replies
View Related
Jul 16, 2008
Title should read "Data Validation Lists"...oops
I'm trying to format a spreadsheet so that based on the value in Column A, Coulmn B displays one of two spearate dropdown menus.
I know the following formula will not work, but that is the effect I want in Column B.
View 7 Replies
View Related
Apr 17, 2014
I am trying to have a column that returns either "secure" or "re-assignable" depending on whether the employees title matches the appropriate office/ space allocation.
e.g. an employee who's title is "CEO" and office type is "Large Exterior Office" would return a secure. However an employee with a title of "Admin Assistant", who's office type is "Large Exterior Office" would return "re-assignable"
View 1 Replies
View Related
Nov 13, 2012
I have a condition setup (under "This Workbook") upon opening a spreadsheet to verify a computer's predetermined motherboard serial number that will shut the Excel workbook down if the numbers do not match. This works fine. What I'd like to do is to add a second condition that will allow a password to be entered in a textbox if the numbers do not match so that the serial number condition could be manually overridden, if necessary. If the serial number and the password are incorrect the workbook automatically closes.
Here is the code that works:
Private Sub Workbook_Open()
If CreateObject("Scripting.FileSystemObject").GetDrive("C:").SerialNumber "-XXXXXXX" Then ActiveWorkbook.Close False
End Sub
Here is what I am attempting to do that is not functioning properly - need to add a textbox to enter a password to override an incorrect serial number
Private Sub Workbook_Open()
If CreateObject("Scripting.FileSystemObject").GetDrive("C:").SerialNumber "-XXXXXXX" Then
Dim Rng
Rng = InputBox("aaaaaa")
If Rng "aaaaaa" Then ActiveWorkbook.Close False
End Sub
View 9 Replies
View Related
Jun 23, 2009
I have a very long code with multiple functions and operations i.e. it calculate many fields. The normal running time varies from 2 minutes to 30 minutes depending on the data size.
Can any one tell me a way so that I can put a kind of status bar to show the progress or estimated time left? Basically, during operation it looks like excel is hanged and not responding but infact its not.
View 9 Replies
View Related
Jan 11, 2009
What is the simplest way to display a "Please Wait.." message during the execution of a macro.
Tried the WshShell.Popup but did not work.
View 10 Replies
View Related
Jul 31, 2013
Below is the code I currently have implemented. The first line of code creates a .csv file. The third line of code opens that file. I couldn't put the third line right after the first because it would try to open the file before it was finished being created. Hence, the second line which waits for 5 seconds. Is there a way, either in the CMD or VBA, that I can have it wait until the first line of code has completed?
VB:
Shell "cmd.exe /c M:" & "&& cd DesktopExcel Project" & Command
Application.Wait Time + TimeSerial(0, 0, 5)
Workbooks.Open("M:DesktopExcel ProjectInfo.csv")
View 1 Replies
View Related
Jan 29, 2014
If I run this in the editor sometimes it works and sometimes it does not.
If I run this in editor with F8, stepping through the code, it does work.
I can only guess that enough time is passing during the F8 presses that the page can load. But is that not the purpose of adding the wait code?
[Code] ....
View 9 Replies
View Related
Oct 13, 2011
Is it possible to insert a wait command in milliseconds- minimum I have seen is a second?
View 1 Replies
View Related
Apr 7, 2008
I've a userform style progress bar which stops updating if i use application.wait within my code like this:
UserForm1.FrameProgress.Caption = "0%"
UserForm1.Label1.Caption = "Starting Process.."
UserForm1.LabelProgress.Width = 0
UserForm1.OkButton.Visible = False
DoEvents
Application.Wait (Now() + TimeValue("0:00:01"))
View 9 Replies
View Related
Apr 17, 2008
been checking out 1/2 a second wait instead of a 1 sec wait
and would like to know it you can do this
timer thing
Dim x As Single
x = Timer
While Timer - x < 0.5
Wend
more than once
it works the first time and then it sort of skips it
or is there ANOTHER way of having a delay of less than a second?
View 6 Replies
View Related
Feb 4, 2010
I'm using a pre-made spreadsheet from my stock broker (Interactive Brokers) that retrieves and displays real-time quotes, and allows one to retrieve historical stock data, among other things. I've created a little macro within it to try and automate some common tasks I do everyday - basically I want to retrieve a year of daily stock quotes for "stock 1" from IB's servers, then have the macro wait for the retrieval to be done and written to the spreadsheet (takes anywhere between 10 and 30 secs). After that's all done, then I want to do the same for "stock 2". Then when that's done, the macro proceeds to go ahead and do some calcs on stock1 and stock2. The problem is after my stock1 data request, the macro just keep on trucking through to the next commands while stock1's data retrival is still going on.
so things are getting all balled up. How can I get my macro to wait until stock1's data retrieval is all done?
View 14 Replies
View Related
Jun 2, 2007
My question is if it's possible to change the code and make it work faster. When I change the ComboBox I wait about 1-3 seconds for about 40 items in the Worksheet. I still didn't test it with more items. Here's the
Private Sub ComboBox1P2_Change()
If ComboBox1P2.ListIndex = 0 Then
ComboBox2P2.Style = fmStyleDropDownCombo
ComboBox2P2.Value = sign
ComboBox2P2.Enabled = False
ComboBox3P2.Clear
ComboBox3P2.Enabled = False
ComboBox1P2.SetFocus
ElseIf ComboBox1P2.ListIndex 0 And ComboBox1P2.ListIndex -1 Then
ComboBox2P2.Style = fmStyleDropDownList
ComboBox2P2.Enabled = True...........
View 9 Replies
View Related
Jan 26, 2009
I have a workbook with alot of results that employees will need to wait for results to show.
While it Calculates.. can we get a cell to show "Please Wait - Searching" so they know its actually doing something for them?
View 9 Replies
View Related
Aug 21, 2006
When clicking the button on my userform, it goes through a quite complex process of changing the views in several pivot tables that are linked to an "report" sheet, which has all the figures the user needs in a neat format.
Changing these pivot tables takes up to a minute, so I wanted a userform, called "frmwait", to pop when clicking the command button. It would say "Generating Your Report - Please Wait". At the same time, the initial userform, which is called "frmroutedashboard", would be hidden.
This does not happen - the "frmwait" userform shows, however the "frmroutedashboard" does not hide.
Is this because the code I composed uses the values on the "frmroutedashboard" to generate the view, and it cannot hide until the report is completed? If so, there must be a way around this. Anyone know how?
The initial code so far looks like this:
frmroutedashboard.hide
Application.Cursor = xlWait
Application. ScreenUpdating = False
Application.DisplayStatusBar = True
Application.StatusBar = "Updating Route Dashboard..."
I thought if it looked like this, it would be sufficient. Unfortunately, the file is too large to attach, so I hope the code suffices.
frmroutedashboard.hide
frmwait.show
Application.Cursor = xlWait
Application.ScreenUpdating = False
Application.DisplayStatusBar = True
Application.StatusBar = "Updating Route Dashboard..."
View 8 Replies
View Related
Mar 18, 2007
Situation:
At two places in the middle of my code I need to specify a particular variable; usually this is done by some autodection-method, but whenever this fails a userform gets loaded and the user needs to do some clicks which finally specifies that variable.
Problem:
So far my code does NOT wait for the userform (and the user-input), but continues running until it fails, cause that particular variable (see above) had not been initialised with the correct value for this run.
My Question:
How can I force the code to wait until the userform has been closed? Or what other way do you usually solve that problem when wanting to use a userform in mid-code? Below you find the place where I load the User form 'UsrFormSpecifyFormat' ....
View 9 Replies
View Related
Nov 18, 2008
when I run a macro, it takes me to a different sheet, clicks on a cell, and then goes to data--> form to automatically generate a form so I can make a new entry. I want the macro to wait until I have completed the form, and on completion to do something else. I'd prefer it if I could indicate completion of the firm by just a keystroke, but a mouse click will do as well.
View 2 Replies
View Related
Feb 27, 2010
How can I put a VBA script to wait for 30 seconds, then close the Excel file (w/o saving it) which its name is stored in CSV_file_name variable, then re-open it?
View 9 Replies
View Related
Feb 4, 2013
I am using Excel 2007.
I have some pivot tables that have the data source in another workbook. I didn't create any external data connections. When I created the first pivot table, I just selected the range from that other workbook. Most of the other pivot tables were copied and modified accordingly, so they should have the same pivot cache.
I have created a macro that basically refreshes all data, using the Workbook.RefreshAll command, then copy/pastes values and then deletes the pivots so that I can send it via e-mail without problems. The macro seems to work fine.
The QUESTION relates to the fact that I am afraid VBA won't wait for the refresh to complete before starting to copy/paste values.
The PivotCache.BackgroundQuery = False solution doesn't work. I get 10004 error. Also, there are no data connections visible in the Data > Connections. I guess that, because of this, "Properties" is greyed out in the Data tab and also "Connection Properties" under Pivot Table Tools > Options > Change Source Data is greyed out. This way, I cannot uncheck the "Enable background refresh" box.
I could just tick the "Refresh when opening the file" in Pivot Table options, but if I open the file without first opening the workbook with the raw data, refresh takes very long.
I have tried to measure time difference between the RefreshAll command and a simple Range("C3").Select command. There is a time difference, but I'm still not 100% sure that VBA waits for refresh to complete before continuing.
VB:
Do Until Application.CalculationState = xlDone
VB:
[COLOR=#333333][COLOR=#333333]DoEvents[/COLOR][/COLOR]
[COLOR=#333333][COLOR=#333333]Loop[/COLOR][/COLOR][COLOR=#333333][COLOR=#333333]
[/COLOR][/COLOR]
View 9 Replies
View Related
Jul 5, 2007
I want to allow users to place files (.jpg, .tif, .pdf, .pps etc) into a network folder and then have my program open each file and display it for 30 seconds then close the file and the application before opening the next file.
1. Set up a loop to get a directory listing of the folder and write the listing to a text file.
2. Open up the text file and get the next filename in it
3. Open the file in the associated application
4. Wait for 30 seconds (or some period of time) and then close the file
5. Repeat steps 2-4
DoIt = 1
While DoIt = 1
Open "C:TempList.txt" for output as #1
Print #1, Files In Folder
Close #1
Open "C:TempList.txt" for input as #2
while not eof(2)
Line input #2, MyFile
Display MyFile on screen
Wait for 30 seconds
Close MyFile and MyApplication that opened it
wend
Close #2
I can get the directory listing just fine with no problems
I can open the files in the associated application just fine with no problems.
with closing the application after 30 seconds or some period of time.
I need some code that will allow me to easily send it a filename and it will know how to close the file and the application that opened it.
View 9 Replies
View Related