Loop Macro. Prompt Input.

Sep 4, 2009

I have several hundred workbooks with multiple worksheets(15-35) that I am trying to tidy up, so the data can be entered into a database. Its my first attempt at VBA and between the forum and macro recorder I made an attempt which is below. I just can't seem to get over the last part. I have searched the forum but can't seem to find any relevant information. I have a couple of questions.

1. I need to be able to run this macro over all the worksheets in the workbook, so how can I loop it? All the worksheets are named differently i.e. peoples names.

2. In my code I have inserted 4 columns. These columns will be the only thing common between all the worksheets. A1 to A30 = Week number, B1 to B30 = Shift Number, C1 to C30 = Supervisor number. Column D is blank. I'd like to be able to be prompted to enter these 3 numbers at the start if possible? Can this be done in such a way as you are only prompted the once and not on each worksheet? I picked 30 rows because the amount of rows in each worksheet varies but never exceeds this. The end of my code "Delete rows where cell B is blank" will delete any excess data where 30 rows of week numbers etc are not needed.

Sub CleanCost1_1()
'
' CleanCost1_1 Macro
' Macro recorded 04/09/2009
'

' Delete Job Card Sheet
Sheets("Job Card").Select
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
' Delete Master Sheet

View 9 Replies


ADVERTISEMENT

Using Input Box To Prompt For Name

Jun 17, 2008

I've not used Input Box function before. When a user opens my workbook I want to check whether a named range ("Name") is blank and, if it is, to prompt the user to type their name in an Input Box which then returns that value to the named range. This is what I have tried but I don't think I am referring to the named range correctly,


Dim strName
If IsNull("Name") Then
strName = InputBox("Please enter your name", "Name Required", "1")
Range("Name") = strName
End If

View 9 Replies View Related

Input Box Prompt For Password

Dec 5, 2007

How The Vba Code Used For

My Excel File Name "eai.xls" ,when I Click The File , It Open The Sheet Name "menu" With The Inputbox Prompt:="put Your Id"
When The User Put The True Id , It Will Show The Input Box Prompt:="your Password" . If The Password True Will Activate The Sheet Name "data" .and Hide All The Menu Bar.

If The Wrong Id Name Show The Msg.box "re Enter Your True Id " ,that Also For The Wrong Password In Which If User Put More Than 3 Times Wrong , Will Close The Workbook And Exit File.

The User Persons Allow 10 Person Id . Keep In The Table Of The Sheet Name " Id And Password" The Id No. Are In The A1:a10
Password No. Are In B1:b10
This Sheet Name Is Hide And Protect

View 14 Replies View Related

Ignore Input Prompt

Apr 18, 2008

I run a macro to open multiple workbooks and run a macro within those workbooks. All worked fine until a message/input box was included in the individual workbook macros [that I cannot change] to notify the single workbook user when the macro had successfully completed and prompts for an “ok” input.

Can I get my macro to ignore this prompt and not wait for an input – I am currently clicking “ok” everytime it comes up on screen. Have searched help and forum but nothing jumps out.

View 9 Replies View Related

Input Prompt Page

Sep 10, 2008

I have eventually got my Worksheet up and running but now im trying to make things a little easier to complete. The plan is when the Engineer is on site he has to open the Excel sheet to check the tests he has to complete and then mark the results. this is fine but for vaildation he has to sign everthing etc... i made it easier so they only had to fill in one box and it would complete the rest but this seems to get missed more often than not.

SOOO

i want a Screen to pop up when some one opens my excel that says Enter name and contact details. then they submit this which updates the spread sheet with this information and then the engineer can continue as normal.

View 11 Replies View Related

Prompt User To Input Column Letter

Aug 23, 2013

Sometimes data comes in with various columns that need Concatenate.

I need VBA to prompt user to input which columns to use inside the formula:

Code:

'Place formula into A2
Range("A2").Select
ActiveCell.FormulaR1C1 = "=COCATENATE(D2&"_"&E2)"

'VBA to copy down formula until last row In my macro, D & E will vary, is there any way to make excel ask which two??

View 3 Replies View Related

Prompt For Data Input When Other Cells Are Populated

Feb 7, 2008

I would like to create an spreadsheet that prompts me to input data into a cell (eg; 'C1' - 'Quantity Ordered') as soon as another cell on the same row becomes populated (eg; 'A1' - 'Item Code'). I need this function to apply for several rows (25 rows in total), so that if data is then entered into cell 'A2', I get a prompt to enter data into 'C2', all the way up to a prompt for data in cell 'C25' when cell 'A25' is populated.

As it is imperative that I never forget to populate the relevant cells; I would also like to 'enforce' the prompt - perhaps by preventing the worksheet from being saved until the relevant cells have had data entered into them, or perhaps by using some kind of form, rather than a messagebox.

View 5 Replies View Related

VBA Script In Excel To Prompt User To Input Date?

Sep 15, 2014

I have a cell (C16) that has a date format (such as 08/28/2014). I want the value of this cell to be "N/A" when cell C7 is "No". When C7 is "Yes", I want Excel to prompt the user to enter a date for C16 when they click on C16. The formula for cell C7 is =IF(C3="No","No","Yes"). That's where the value of C7="No" comes from. If I didn't need a date for the value of C16, the formula would be something like =IF(C7="No","N/A","______"). I have just recently started trying Excel macros due to a tool

View 9 Replies View Related

Dropdown List With Prompt Box To Enter Value And Hide Input

Feb 5, 2013

I am looking to allow a user to enter a unique value when a drop down value is captured from a list i.e 'Other' (Possibly a pop up box), then I require this value to be hidden and calculated along with others to show the average (The average calculation obviously wouldn't be in the same cell).

View 8 Replies View Related

Command Button Prompt To Input 2 Columns Of Data

Jul 19, 2014

My new Time in Motion sheet is coming along nicely with some snazzy programmed Command Buttons to fill data into another sheet.

One of my buttons is for 'other' tasks, so I'd like to programme a button to prompt first for a number of minutes (e.g. 30), and then a brief description (e.g. Meeting) and input the data side-by-side in 2 columns on sheet 2.

This is what I have for my other single-entry buttons, so what would I need to add?

Dim ans As String
ans = InputBox("Case reference:", "Data Entry")
Sheets("Sheet2").Range("F" & Sheets("Sheet2").Range("F" & Rows.Count).End(xlUp).Row + 1).Value = ans

View 1 Replies View Related

Add Loop To Input Box

Apr 16, 2009

I have an input box that request the user to enter a vlue between 1 and 6, and uses the answer to multiply another range of cells.

Now I'm not sure how to add a couple of other features. I would like to:
1. Loop the input box until an acceptable answer is given, (numeric, between 1 and 6), with a message box prompt that says "Try Again".
2. Exit the macro if the user hits "Esc".

Here is my current

View 6 Replies View Related

How To Input If Statement In For Loop

Jul 31, 2013

I have a code like this below

Sub Copydata()
Dim emre As Integer
For emre = 100 To 121
Sheets("CP TB").Select
ActiveSheet.Range("$B$8:$G$10000").AutoFilter Field:=3, Criteria1:=emre
Range("E8:F8").Select

[Code] .....

I want to skip values when the selection is a value I choose. I tried to put a "If" statement but I couldn't make it work.

The IF statement will check the selection after red colored code. if cell value is "a" then it will go for Next emre.

View 6 Replies View Related

Loop Through Range Find Value Input Box?

Jun 20, 2012

I have a range (C3:C56). I have a set number in each of these cells. I also have a range out to the side that calculates a number after input a % in cell BI2. The formula reads as "=AE3-(AE3*$BI$2)". Basically it is reducing the values in my range. If a number is in my range is 8 and i input 25% in cell BI2, then my result would be 6.

I have a few steps I want to happen with this range.

1 Display an input box asking for a percentage
2 I want to loop through my range and use that percentage to reduce the numbers
3 (optional but would be amazing to have) after the reduced value is determined, round down to the nearest multiple of 4.

View 9 Replies View Related

Cancel OR Loop Input On Worksheet Name

Jan 27, 2014

I am trying create a macro which asks for the Sheet name as an input for a Sub. I've gotten it to work but there is just one problem: The Cancel button does not work on the MsgBox. Everything else works just as I want to: it shows a dialog box to enter a name for the worksheet and if the worksheet does not exist, it loops and shows a message saying that it does not exist.

However, the cancel button does the same thing as entering nothing in the box and it does not end the process. I would want it so that the cancel button kills the process. Here is the code:

Code:
Option Explicit
Function WorksheetExists(WSName As String) As Boolean
On Error Resume Next
WorksheetExists = Worksheets(WSName).Name = WSName
On Error GoTo 0

[Code] .......

View 2 Replies View Related

Entering Input And Clicking Buttons During Loop

Mar 22, 2009

I am basically creating a questionnaire style program where the user gets asked 50 questions, one by one and they input their answer and press another button (submit button). They initially press a start button to start the questionnaire.

So far, I have created a range of questions and it fills one row where the questions are entered. In intend to use a for loop to go though all 50 questions.

Now this is where I’m stuck. I have a submit button and after each question is displayed, I want the user to enter their answer and then click the submit button to then continue to the next question.

However, I can’t think of how to do this.

1.Firstly, how can I loop through the questions and yet allow the user to input their answers after each iteration?

2.Also can I even click the submit button during the loop phase? I.e. when already running.

View 3 Replies View Related

Macro To Prompt Key In Date?

Jul 21, 2014

excel macros and only know how to record certain tasks, and then edit after recording the task.

I am working on a project to automate a daily routine task for a company which involves creating a new tab and inputting various datas.

How can I create a macro such that I create a new tab and a combobox appears asking me to input the date in a particular cell?

This is the first in a number of steps for fully automating this process.

So far I only have this to create a new tab.

------------------------
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveSheet.Copy After:=ActiveSheet
End Sub
------------------------

View 1 Replies View Related

Override Prompt From Another Macro

Oct 12, 2009

I have a macro that performs an operation on all Excel files in a given folder. The only problem I had was I couldn't walk away until it was done because the files themselves had macros that gave me a Yes/No prompt to recalculate.

I already have a calculate command in my macro so how can I override this command without physically selecting and clicking "No" with my mouse and without editing the macros that are already in the files (each unique and embedded in the individual worksheets). I cant edit each file because there are close to 300 of them.

View 9 Replies View Related

Password Prompt Macro

May 3, 2007

I need to put together a macro, which will be assigned to a command button, that will prompt the user for a pre-specified password, and, if the password is correct, return a pre-specified value in a different cell. Is there any way to do this?

To put it in perspective, at my company we have approval sheets that need to be signed by several executives that are scattered all over the building. The first executive gets the copy, signs it, sends it off, etc. They tend to dissappear on occasion, so we are looking to make it all electronic, where they can access the file in a shared folder, and the if they enter their password correctly, their initials are input into the specified cell. They can than save the file for the next executive to do the same.

View 5 Replies View Related

Refresh Input Cell And Capture All Outputs From Each Loop

Jul 10, 2014

Assuming I have three worksheets:

1) input: col A has a series of product code (string)
2) calculation: where I want to automatically copy and paste each product code from "input" worksheet into "calculation" cell B4, and through many steps of calculations, return the outputs in cell B8 and B9 (parameters are numeric)
3) output: how to automatically record B8 and B9 from "calculation" sheet to this sheet Row 5 and 6 from each loop? (format of output doesn't really matters)

View 4 Replies View Related

Looping- Loop To Force A New Date Install Via A Input Box

Jan 7, 2010

The code below first asks a user to input a weekending date (which must be a Saturday). The value of the input box goes to cell C1 of my spreadsheet. That part works fine. I also have a function in Cell G1 with the function:

=TEXT(C1, "dddd")
I don't know if this is the best way to test for a Saturday but it is what I have,

Where is goes bad is if the date is not a Saturday. I have a loop to force a new date install via a input box but it won't update C1 with the inputed data to recheck for the Saturday value. Below is the whole code I am working with...

Dim aa As String
Dim bb As String

If Range("C1") = "" Then
Do While bb = ""
bb = InputBox("Please Enter a Weekending Date!")
Loop
Range("C1").Value = bb
End If
If Range("G1") "Saturday" Then
Do While aa "Saturday"
aa = InputBox("Weekending Must Be a Saturday. Please Enter a New Weekending Date")
Loop
Range("C1").Value = aa
End If

View 9 Replies View Related

Print Button Macro Prompt?

Mar 23, 2014

I have a print button or object and I want to assign a macro to it that when clicked brings up a prompt to type in a Month or Year to Date and prints the data that corresponds to that month or YTD. I have a Date column in a table that I can get a different macro to print by basially having the macro filter by blanks, so essentially printing all the dates in the table, but I feel as if it could be much better and simpler by prompting the macro to filter by "x" Month and print.

View 3 Replies View Related

Macro With A Password Prompt Routine

Feb 11, 2009

I am trying to complete a toolbar that will lock and unlock all the sheets in a workbook. While I can set the password automatically I'd like to have the macro ask for the password instead of hardcoding it.

Here is the code I currently have and works so long as I have already set the password in the workbook to match what is in the macro

View 3 Replies View Related

Macro To Prompt Where To Browse For The File

Aug 28, 2009

I have looked in books and online and can't seem to locate how to create a macro that opens a browse function. From Excel I would like to click a button to start a macro and have that macro prompt me where to browse for the file. There is a lot of other code that will go after this step (which I already have), so once I click to "open" a file I want the macro to continue.

View 6 Replies View Related

Macro To Pull Up Hyperlink Prompt

Mar 15, 2013

I'm trying to create a macro that I can assign to a clip art pic that will pop up the Insert Hyperlink prompt when I click on the picture. So basically anytime I click on the pic for the 1st time I'd like to be able enter the url address of my choosing but if I were to click on that pic again I want it to go to the Hyperlink address I previously entered.

I should note that I tried recording a macro by first by clicking on Record Macro then press ctrl + k and then click Stop Recording but it wouldn't stop recording. I had to first click Cancel on the Insert Hyperlink prompt and then I was able to Stop Recording so this attempt was unsuccessful.

View 2 Replies View Related

Confirm Prompt Before Macro Runs

Nov 20, 2006

I have a button. When pressed, it runs a macro. Instead, after pressing the button, I would like the user to confirm to run the macro and display some info about it. This is to make sure the user does not accidentally run the wrong macro (button). I just need a prompt box, with a line info, and the two choices YES and NO. If NO is selected, nothing happens. If YES is selected, macro continues.

View 6 Replies View Related

Prompt For Confirmation Before Running Macro

Oct 5, 2007

I have created a macro, but running the macro will replace the data that are already in the cells. So what I would like to do is to have a pop-up window come up when clicking the macro button asking if you really would like to proceed

View 2 Replies View Related

Macro To Prompt Protect Sheet Box On All Tabs?

Jun 20, 2014

Macro to Run all tabs in a workbook and prompt a pop up asking about sheet protection for each tab, such as Select locked cells, and select unlocked cells.

View 8 Replies View Related

Database Query Macro- Password Prompt

Feb 26, 2009

I have created an Excel sheet that retrieves data from a ODBC source. I have created a macro using macro recorder to refresh the data by re-connecting to the database. However, the connection requires a password prompt and when the macro is run, you are still required to enter the password.

Is there anyway to make the macro so that the password is automatically entered and the user will just have to press a button to fully run the query update?

View 2 Replies View Related

Macro Including User Prompt Feature

Dec 18, 2009

Looking to write a macro which includes a prompt to the user for use in Excel 2007.
Specifics....Have a workbook including many worksheets with a common layout. Would like to write a macro to copy specific defined ranges from one worksheet to another but within the macro it would prompt the user to type in the worksheet name to copy the ranges from.

Example....User is at worksheet C in the file containing worksheets A, B, C, and D. User starts the macro and a prompt comes up for the user to input the worksheet name to source the ranges from (in this example A). User types in "A" in a dialog box and the macros copy/pastes the contents from range B4:B35 and Z2:z20 from worksheet A into those same ranges in worksheet C.

View 5 Replies View Related

Macro To Prompt For Save Location And Filename

Feb 22, 2014

In a workbook, I use a macro to extract a sheet and save it as xls.

What code should I use to prompt the user to define the location and name of the new file to be saved?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved