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
ADVERTISEMENT
Oct 15, 2007
I am using the following coding on my s/sheet at the moment...
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim r As Range
Application.EnableEvents = False
For Each r In Target
If Trim(Len(r.Value)) = 1 Then r.Value = UCase(r.Value)
Next
Application.EnableEvents = True
If Selection.Count = 1 Then
If Target.Row > 3 And Target.Column > 14 And Target.Column < 19 And Target.Value = "Y" Then
MY_LINK = InputBox("As you have entered 'Y' into this cell, please provide a link to the document. If there are no documents available for linking, please click cancel and change the value of the cell to 'N'.", "Document Link Request")
ActiveSheet.Hyperlinks.Add Anchor:=Range(Target.Address), Address:=MY_LINK
End If
End If
End Sub
The top code is to change all singular small letters to caps... and the second is to bring up an "enter hyperlink" box when "Y" is typed into a particular cell...
Can anyone edit this 2nd code to include a "browse" button, so that when entering the hyperlink, it can be to a file on the computer?
View 9 Replies
View Related
Jan 22, 2008
I am using VBA to create a weightloss calculator and everything is going fine ecept the Vbyesno boolean that will not allow me to delete the data that i want.
I used a macro to delete the information that i want to delete and i know it works because without the vbyesno, it works fine.
With the vbyes no, both yes and no do nothing when clicked and the yes no box just closes.
The macro code is stored in a private sub called "ClearAll"
My code is:
Private Sub Restart_Click()
Dim Response As Boolean
Response = MsgBox ("Are you sure",YbYesNo)
If Response = VbYes Then
Call ClearAll
End If
End Sub
What am i doing wrong?
I also want to make the no button the default, how do i do this in conjunction with the code above?
View 4 Replies
View Related
Jun 19, 2013
I have got a protected sheet with macros, how can I ensure that users can only open the sheet as Macro enabled only otherwise the sheet would not open?
I understand that some users may have different Macro security settings?
View 1 Replies
View Related
May 2, 2008
I need a macro which collects data from two files and dumps it into a separate spreadsheet. I need it to prompt the user to select the two files, since the file names may change.
Once a user selects the files, the macro simply opens them, grabs the data (the data sits on a single sheet in each file) and pastes it into a file, and closes the 2 data files.
The Data sits in A7:N20 on both files.
View 14 Replies
View Related
Oct 4, 2008
I have created an addin that runs several macros. To enable the user to undo any changes, I keep a backup prior to them using any of the macros in the form of a worksheet named back00xx. I want a prompt to be displayed to the user to remove these backups at the closing or saving of the file. The problem is that as an addin, how do I get it to display this prompt as the open workbook is not part of the addin.
Could one have a looping routine that is checking every xx min/sec to check if the current workbook contains any sheets starting back00
View 9 Replies
View Related
Aug 7, 2009
This file pulls totals from external links. The way I have it set up is that every month our log is saved to a naming scheme involving the date, then a fresh log is created for the current month. So, for each month I have "log mm-yyyy".
Now, the chart file is a thirteen month rolling chart (meaning every month it must show the thirteen most recent month's totals). I have created a macro to automatically update the links, based on an input in cell A:1 (meaning you can enter a date in the past and view the thirteen months previous). The problem is that we have only been doing the log for 10 months. So, when the macro runs to update the links, and it gets to months 11 through 13, it pops up a window for the user to manually browse for the missing(non-existent) files. There are quite a few cells that contain links to various information on these logs. I get a prompt for each cell and have to click "cancel". Once I have clicked cancel through all of the broken links, then everything works great.
My question (after all that) is, is there a way to suppress the prompt for the user to search for the missing file? Like I said, this chart is for management, and they shouldn't have to click cancel a dozen times just o look at a chart. If the file doesn't exist, then just break the link.
Obviously once the next three months are over, this problem will disappear, but in the mean time I need a solution.
View 6 Replies
View Related
Oct 8, 2009
I'm building a spreadsheet that consolidates multiple worksheets into one. I've got that portion done, but what i need help with is a user prompt. I don't have an example at the moment, but it should be fairly straight forward.
Rather than consolidating all the data into one worksheet I want to consolidate only the rows that contain certain information. The column I need to query in each worksheet is "BL". The only thing is that column won't always contain the same data. Is there a way to do basically a prompt to where it searches for the data they want and if it isn't in there it just moves on to the next worksheet automatically?
View 9 Replies
View Related
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
Dec 16, 2007
- Prompt User for Text String
- Fill in Column B from B2 to B(LastRow of ColumnA) with the Text String
For example if
Column A
Ant
cat
Dog
and the user enters the text string "Animal"
then Column B will look like
Column B
Animal
Animal
Animal
The number of rows in Column A vary across my excel sheets.
View 6 Replies
View Related
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
May 29, 2013
I've recorded this code and am looking to include it in a button. I would like for when a user clicks the button assinged macro that the active sheet is cloned and saved as a CSV file. The user should be prompted before saving on where (file location) they'd like to save the file.
Sub CloneWorksheet()
'
' CloneWorksheet Macro
'
'
Sheets("SDW&Customer Workshop scheduled").Select
Sheets("SDW&Customer Workshop scheduled").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:Documents and Settings1167916My DocumentsTestBook1.csv", FileFormat:= _
xlCSV, CreateBackup:=False
End Sub
View 9 Replies
View Related
Mar 16, 2004
Is there any way of creating a log that logs the last user that saved the workbook including the date and time. I would like the log to be a sheet hidden in the workbook. Not many people will be saving the workbook.
View 9 Replies
View Related
Jun 11, 2013
Basically, in the "Thisworkbook" code , i have some code in the Workbook_BeforeClose section. Currently , it autosaves the workbook in a folder i have specified.
However, i need to add some code.I want to check that a certain cell has a value in it before the user closes the workbook, and if the cell is empty, show a messagebox asking him to enter a value.
I know how to get a messagebox to pop up, the only thing is once the user clicks the OK button,
i need the rest of the code execution to pause, allowing him to make the change then if he clicks the "X" (top right of the screen) to close the file or application, the filesave dialog appears and he can then save the document.
how to go about this because at the moment when user clicks ok, the messagebox just disappears and filesave dialog appears and he doesn't have a chance to edit the cell.
View 5 Replies
View Related
Sep 2, 2009
Split From Run VBA Macro From Another Procedure. will it autosave and open all the archives in the file i specify and loop?
View 3 Replies
View Related
Apr 20, 2009
I am trying to display a message box for the user if there is "agency" in cell o8 but nothing in p8... I tried the following code but it doesnt work..
If Range("o8").Value = "Agency" And Range("p8").Value = "" Then
MsgBox "Please provide name of agency in cell p8"
Sheet9.Shapes("cross").Visible = True
Else
View 9 Replies
View Related
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
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
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
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
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
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
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
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
View Related
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
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
Apr 12, 2007
I am currently working on a project that adds shoes to a re-order list, and a receipt automatically when they are 'purchased'.
The re-order list is great as the shoes 'purchased' are supposed to be added one after another, my problem being that the receipt is for a customer.
Once the shoes 'purchased' are added to the receipt it can be printed. I then need to be able to clear the rows with values greater than 0 so that I can start with a new customer, on a clean receipt. I need it to check starting from row "A3" so that my receipt format is not messed up, and for it to finish leaving 2 blank rows so that my other macros still work.
I would like to use a macro to clear the rows to make it easier for the user.
If anyone has any suggestions I would be very greatfull and if you require the document I can arrange for it to be sent via e-mail.
View 9 Replies
View Related
May 30, 2008
I manually create a pivot table (and record my actions) the pivot table references all of the information in my data range (70k+ lines). When I run the recorded macro the new pivot table limits the data range to the first 65536 lines (the old limit)....
View 6 Replies
View Related
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
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