Input Box Result To Be Used In Code
Aug 4, 2006I want to have a code where I can have an input box accept a value of text, such as aname and then use that value throughout my code, I will also be saving a file using that name
View 4 RepliesI want to have a code where I can have an input box accept a value of text, such as aname and then use that value throughout my code, I will also be saving a file using that name
View 4 RepliesVBA code to use input box result in a Concatenate function.
Sub test()
Dim DistName
DistName = Application.InputBox("Enter District Name")
ActiveCell.FormulaR1C1 = "=CONCATENATE(R[-2]C[1],"" Diabetes Dist"")"
End Sub
I want to replace R[-2]C[1] with the result from the input box.
Macro Based on an input cell’s (e.g. B12) setting of “yes” or “no”, format several other cells (e.g. B20:G20, B23:F23, C26:J26) as follows: keep the existing yellow shading if input cell is “yes”, change to grey shading if input cell is “no”. I would like this macro to run automatically whenever the input cell value is changed.
View 2 Replies View RelatedI'm trying to work out the way of having a cell give a result based on what has been input into two other cells.
Basically I'm doing up a risk management spreadsheet. I need to have in one cell the LIKELIHOOD of an incident, in the second cell, the CONSEQUENCES of it happening and ending up with a RISK MANAGEMENT ASSESSMENT in the third cell.
I have 4 columns in a worksheet.
A B C D
number type date name
I am using an input box to enter the value of column D. After the value of column D is entered, I want a message box that displays the corresponding data in column A and B. with the vba coding?
The following codes work well but when I have changed the following condtion ,
If cel = Tgt.Range("A2") Then
to
If cel "" Then
I got worng result, can anybody help me to correct it?
Option Explicit
Sub test()
Dim sh As Worksheet, Tgt As Worksheet, i As Long, j As Long
Dim d, a
Dim c As Range, Rng As Range, cel As Range
Set Tgt = Sheets("Report")
Set d = CreateObject("Scripting.Dictionary")
j = 0
On Error Resume Next ...............
I can't seem to get why one code is giving a correct solution and the other one, not even close. They are both identical but there are some difference.
The program is suppose to pick up about 11 cell values, it then store these cell values into a collection, and randomly picking out the 11 values without repeating until there is no more to pick out.
Here is the code: (the top one doesn't give the correct result, it picks it out of the same ones and the number doesn't seem to store correctly, the bottom codes works as it suppose to work.)
Code:
lastCol = Cells(215, Columns.Count).End(xlToLeft).Column
Dim C As New Collection, I As Integer, rdom As Integer
rowFOUR = 216
colFOUR = 2
'cntHIT = 0
rowtest = 216
[Code] ..........
Am trying to get the sheetcalculate to be triggered and execute VBA code when a formula changes its result from positive to negative. The code works fine if I trigger it with a command button click. Auto Merged Post Until 24 Hrs Passes;
View 2 Replies View Relatedthis function I manage to select the result in terms of the objectives of the product code. and I need to search for a piece of the product code. The results will be the same in accordance with fragments but not the exact code.
View 5 Replies View RelatedIs there a way to use cmd prompt via vba?
I would like to run "HOSTNAME" and have that displayed as msgbox text.
I am hoping its fairly simple and diverse so I can just change the cmd code to suit.
E.g.
Code:
private sub gethost()
dim host as long
host = (CMDRUN) "HOSTNAME"
msgbox "your host name is " & host
There must be a way so would like to see but I am struggling to get results on search engines.
Control Code input. I work with Autocad, when I extract data from a drawing into an Excel format (.xls) the extraction does not up date.
What I mean is:
In cad I input 6”%%C L=7” and get 6”ø L=7”. I need the excel file to convert as well. I need to program the cell? How?
If I have a cell which has been validated and has a drop down list of 4 names in it.
I need it to prompt the user that when they choose there name and select, a window pop up or similar window appears asking for a 4 digit(or similar) code.
This is to stop others using peoples names against jobs they have completed so there is accountability if there are issues with information.
For each line I need it to re-prompt the user to enter the 4 digit pin so it cannot be tampered with.
Can anyone help with sending through a form and VB code possibly which I can copy into my spread sheet or a method I can use!
I want to create some VBA code, but I don't know how to do it, that allows the user to make a copy of any worksheet he/she wants within a workbook and then name the copy of the worksheet whatever he/she wants. The copied worksheet should come at the end of however many worksheets exist in the workbook.
I want to accomplish this by using input boxes for the user. I want the user to click the macro and then the input box appears asking him enter the name of the worksheet he/she wants to copy. Then I want the input box to ask the user to enter name for the new copied worksheet. That's it!
A cancel button on the input would be nice just in case the user decides not to copy any worksheet.
Not sure if this can be done, but a colleague of mine is trying to record a macro which is not cell or area specific, but content specific. i.e :copy only if cell A3:A10 = "rabbit", then paste in another tab cell B7:B14.
View 2 Replies View RelatedIs there a way to change a line of vba code using an input box?
The current macro downloads a file from our intranet. However the filename changes each week. It is only the last portion of the filename that changes since this part is the date it is created. e.g filename010507.xls filename090507.xls
What I want to do is for an input box to pop up, the user then enter the date and this will then replace the existing filename in the code with the new date.
On the "If not Isempty" line, I am trying to input a box prompt. Instead of standardizing this macro, I want the user to be able to select a dollar amount to search and place on sheet3. Right now it works fine using 1.29 as the amount. However, I have other stores where this dollar amount is different, so I want the store managers to be able to choose an amount to search, for example 1.39, 2.99 etc...
View 2 Replies View RelatedI have made a MsgBox which opens on Workbook opening with a message as follows:
View 4 Replies View RelatedI wanted to change a column text to call intial Caps. I found this macro code on the microsoft web site
Sub Proper_Case()
' Loop to cycle through each cell in the specified range.
For Each x In Range("C1:C5")
' There is not a Proper function in Visual Basic for Applications.
' So, you must use the worksheet function in the following form:
x.Value = Application.Proper(x.Value)
Next
End Sub
I need to change the macro to have a input box (asking what column to convert text to initial CAPS)
I am trying to build a simple spreadsheet for my salesman that given a customer's zip code, it looks up the corresponding territory code for that zip code. I have conditional formatting setup so that it colors the zip code that matches the one inputted, but how do I then return the value of the corresponding territory code. The spreadsheet being searched is a simple 2 column list, with the headings: Zip Code and Territory. What's the best way to get the territory code back to my worksheet?
View 9 Replies View RelatedI usually just use macros to clean up Data from non-excel sources. So I wrote a macro to do this, but the process requires a date to be added, so attempted to do this via an input box. The input box works, but the code doesn't, clicking the button to which the macro is bound spits out an error 91 (object out of bounds?) when it hits the search function right after the inputbox code. Both bits work as intended separately, so I guess it's just some moronic formatting error on my behalf.
[Code] ......
Couple ways:
1) Format the cell as Text: Format->Cells->Text
2) Enter the zip code with a ' preceding the number, i.e. enter 00345 as
'00345
3) Enter the zip code with the formula ="00345" ...
I have code that I just noticed will not work if user inputs a capital S. I have tried a few things but I can not seem to get it to work. Here was the original code:
If Range("H13") "s" Then
I tired this:
If Range("H13") "s" or "S" Then
I have a button set to bring up an inputbox. enter serial number.
What I need to do is enter the serial number and then have the macro look through a
single column of values to match it then go to that row.
This seemed so simple I thought I could get it but alas here I sit...
I have tried to search the forum for a similar code but haven't found one that was close enough to make sense to me. I have ut together alot of individual actions, but how to get the value inputed to "search" the column and once found go to that row.
I also need to make sure it accounts for new rows being added in the future. (no set row range)
I have created an AddIn for a project I'm working on using the 'Open' command in Excel Vb. While this worked perfectly for the file I was testing it on (1,740,754 bytes) it doesn't work on a new file (121,445,125 bytes).
On testing the code, one line at a time, it gets stuck on
Line Input #1, DataLine
The files only contain one line so I suspect there is too much data for the command to handle.
Is there an alternative?
Modify Macro3 and use the InputBox function twice so that Macro3 would ask the user for a particular month and a particular year; and then Macro3 uses these user’s inputs to create the calendar template for that month of the year. For example, if the user enters February for the month and 2012 for the year, Macro3 would create a new
VB:
Sheets("Template").Select
Sheets("Template").Copy After:=Sheets(1)
Sheets("Template (2)").Select
Sheets("Template (2)").Name = "January"
[Code]...
Need way to interupt my code whilst the user selects a row. ie. if I wanted to move the contents of one row to another I would want to say: "select source row" (and want the user to click on any cell in that row) I could then put the rownumber in a variable with
View 2 Replies View RelatedI am using the following piece of code to delete unwanted rows from a worksheet:
Sub DeleteDates()
FinalRow = Cells(65536, 3).End(xlUp).Row
For i = FinalRow To 1 Step -1
If Cells(i, 3).Value Like "*2007*"
Cells(i, 1).EntireRow.Delete
End If
Next i
End Sub
What I am working with is a sheet of about 5000 customer appointments going back to the beginning of 2006. A have peiced together a lot of code to format it exactly as I want and to create a pivot table of what is remaining after the rubbish has been deleted.
However I am finding that I need to keep amending and re-running this bit of code, depending on the date range I want to look at. For example the code above will delete all appointments made in 2007.
My question is: is there a way that I could incorporate an input box, whereby excel asks the user for a start date and an end date and deletes any rows outwith that range?
Some important info: All of the dates are in column C, in the format mmm yyyy
I would only need to narrow down to a month - so for example mar 2008 - jun 2008
This is probably far easier then I am making it but I need to take the information that is in a textbox created through the control toolbox and copy and paste that information into a cell on different tab in the workbook. I have tried the infamous google and haven't been able to find much. The excel books that I have don't really touch on the control toolbox functions.
View 2 Replies View RelatedI have a project coming up where I will receive tables in a certain format. I want to be able to create a macro that well create a chart based on a single inputted cell (start of data). The chart will have 4 series and five values per series. See the link below for sample data! The first data point is not in the same place in the sheet, but the table will have the rest of the data relative to that!
[URL] .......
I want to enter a unique ID into an input box which will tell which row that id is available and then it will again ask me which column the cell needs to be highlighted. Once i enter the data, it will then ask me what is the change in data (again via input box). i can then enter the change data and then it stops.
View 1 Replies View Related