Putting Input Box Into Existing Code

Jan 22, 2009

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


ADVERTISEMENT

Putting Input Into A Macro

Apr 24, 2007

I would like to write a macro that would start by asking me something along the lines of, "Enter student # you want to print a report about." The # I enter would need to be stored as a variable in the VB code, and then my code would need to use the variable to do some search and replace operations. (Replace all instances of 10 (the default student number) with the variable I have specified).

I don't really know how to even start going about this. How do I get Excel to ask me for a variable, and then use that variable in code?

View 9 Replies View Related

Putting Another Code In The Same Sub

Jul 1, 2008

putting another code in the same sub.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Set rng = Range("O2:O501")

If Intersect(Target, rng) Is Nothing Then Exit Sub

If Target.Value "X" Then
With Target
.Value = "X"
With .Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 14
.ColorIndex = 3
End With

Plus this one

Set rng = Range("P2:P501")

If Intersect(Target, rng) Is Nothing Then Exit Sub

If Target.Value "X" Then
With Target
.Value = "X"
With .Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 14
.ColorIndex = 5
End With

View 9 Replies View Related

Putting A Variable Range From Excel Into SQL Code

Feb 12, 2010

I suppose this is kind of SQL as much as anything so apologies if this isn't really the right place for it.

I had an idea of how to use a concatenated string in Excel to utilise the SQL IN statement for listing parameters that vary from day to day.

Annoyingly my code does not work:

If my range of codes is for example

XS0330509760
XS0242821717
XS0241172948.................

View 9 Replies View Related

Search Existing Data Through Userform New Input And Insert If No Duplicate Found

Jul 18, 2012

I have been able to make a excel sheet which takes inputs from userform for First Name, Last Name, Address etc. I have included a duplicate check for column "B" for "First Name". This checks if any existing data is already which matches the new data input for "First Name" through userform.

The userform only checks for the "First Name" check as required and gives a message that duplicate has been found. Then I have to close the userform and do a Control Key+F ( to find the new name for example, James) in excel sheet and validate that new name is same or different from existing name "James". This I want to do since this new name "James" may be another "James" as his "Last Name" is different. So even though First Name is same, since Last Name is different I know they are two different persons. In that case I will add the entry manually in sheet, instead of userform, since I would not be able to input the new data for "James" since the duplicate check with the current code will not allow me to do so.

What I am current trying is -

1. If the new name say "James" is entered through userform, then excel should point me to the existing row where the record for existing name "James" is there, say row 4.

2. Now without closing userform I should be able to see in the background excel sheet the search results for "James", as excel is pointing to that now. There may be multiple "James" in the existing which should be pointed out.

3. Based on the results that I see in the background excel sheet I can now decide that, this new name "James" is different from old "James" (of row 4) since his Last Name is different. Accordingly excel code should then ask me to add this record or discard this new record.

4. Duplicate check for First Name is enough for me. I would not require "Last Name" duplicate check.

I hope I have been able to explain my problem. I have also attached my current code as I am not able to attach any sample test file.

Code:

Private Sub cmdCancel_Click()
Unload Me
End Sub

[Code]....

View 9 Replies View Related

Trying To Combine Existing Code

Mar 27, 2009

I am trying to combine the 'Mail Range' from this code http://www.rondebruin.nl/mail/folder2/mail4.htm with the 'Mail to address in A1' from this code http://www.rondebruin.nl/mail/folder2/mail5.htm and can't make it work. Maybe this is the wrong tactic to take but I have very little knowledge about writing my own code. The ideal solution would make a copy of a a specific range of cells from a specific sheet, mail it to a recipiant (could change based on what is entered in the field) and delete the copy. I will try to attach an example next week.

View 4 Replies View Related

Adding Second Range To Existing VBA Code?

Nov 13, 2011

adding an second range (J1089:AI1147) to the follwing code.

Code:
Sub Clear_Range()
Application.EnableEvents = False
With Range("H3:AL1058")

[Code]....

View 2 Replies View Related

Add Date Last Modified To Existing VBA Code

Feb 10, 2014

I copied this snippet from the net and it has been working like a charm. I would like to add DateLastModified to it, but I can't get it to work, I'm still kind of new to more complex VBA codes. Here is the code...

Code:
Private Sub CommandButton1_Click()

Dim cell As Range
Dim selcell As Range
Dim Value As String
Dim Folder As Variant
Dim a As Long

ReDim Folders(0)

Set cell = Range("B8")

[Code] .........

View 7 Replies View Related

Code To Use Existing IE Tab To Pass Different Queries On Google

Jun 20, 2013

I need a code to use existing IE tab to pass different queries on google search.

For example:- If active cell contains "manoj Kumar" then macro will search "manoj Kumar" on google and if i select another cell then code will pass the another google search query on the same active IE window(It will not open new window or new tab).

View 4 Replies View Related

Debuggin The Existing Code To Copy/paste

Jul 11, 2007

I use for another template and it works fine. Only change I would like to make is the column headers starts in Row 4. Col B. Some how this is not working for me.

Sub ITD_REV()

Application.ScreenUpdating = False

With Sheets("Data").Rows("1:1")
Set c = .Find("CONTRACT #", LookIn:=xlValues)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
c.EntireColumn.Copy
Sheets("Test1").Select
Range("B3").Insert shift:=xlRight
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address FirstAddress
End If
End With
End Sub

Again...incase what I said does not make sense: I want to copy certain columns with fixed header names, e.g. "CONTRACT #" into another sheet name "Test1" and paste starting into cell B3. Another column would be "Contract Name" and so on. Also, these col header names may not be in order. In "Data" sheet, col header names starts in row 4.

View 9 Replies View Related

Automatic Update In Other Sheets: Need Some Changes To The Existing Code

Aug 29, 2008

I have already got an anwer for this long back from this site. The code was writted by Mr. Krishnakumar
the thread is here :[url]

i need some changes to be made in this code. The existing code creates and updates the details in the sheets automatically from the master data. I just need the sum of Column I in all the sheets after the last row of Column I.

selecting all the sheets and typing the formula in I column is not possible because, the last row in Column I is different in all the sheets.
In sheet 1, the last row of Column I is Row 15, in sheet 2 Row150 is the last row.
I guess something could be done in macros.

follwing is the existing
Sub TestIt()
Dim sWS As Worksheet
Dim Sellers As Range, Seller As Range
Dim lRow As Long, fRow As Integer
Dim CopyRng As Range, ws As Worksheet

View 9 Replies View Related

Macro Code To Add More Rows To Existing Chart

Jun 17, 2008

I have managed to create something similar to what i am working for using an example from Lacher and Gant Charts. i am now stuck as I can enter more than 40 status as it then gives me an error. The following is the code: Can any1 highlight where i need to make any changes to stop the error from occuring:

Option Explicit
Sub CreateTimeChartData()
Dim vTimeData As Variant
Dim i As Integer
Dim sRoom As String
Dim vLastEndTime As Variant
Dim oSeries As Series
' set up
Application. ScreenUpdating = False
Application.DisplayAlerts = False
' create chart data worksheet
With Worksheets("TimeData"). Range("TimeList"). CurrentRegion
.Sort Key1:="Room", Key2:="Start Time", Header:=xlYes
vTimeData = .Value
Worksheets.Add
On Error Resume Next
Worksheets("ChartData").Delete..........................

View 3 Replies View Related

Amending Existing Code To Add New Column To Macro Output

Jun 4, 2014

Attached is my sample data Sample Data_Combine Sheets.xlsm.

What the code in the attached sheet does is that it combines the data in Sheets Set1 and Set2 into the worksheet named "Combine".

Both input sheets share same columns. Code I use is as below:

VB:
Sub BuildPivotData()
Dim wrsht As Variant
Dim i As Integer

Sheets("Combine").Range("A2:AI500").Clear
wrsht = [{"Set1", "Set2"}]
For i = 1 To UBound(wrsht)
Sheets(wrsht(i)).[a2].CurrentRegion.Offset(1).Copy Sheets("Combine").Range("A65536").End(xlUp)(2)
Next i
End Sub

I want to amend the output in such a way that when the macro is run , in the "Combine" worksheet an additional column is added at the start(col A) with header as "Category".

The category should be nothing but the input Sheet name i.e Set1 or Set2.

Here is an example ... Output Sheet.xlsx.

View 3 Replies View Related

Code To Copy, Paste Without Replacing The Existing Data

May 21, 2009

I have two sheets - sheet1 and sheet2. Everytime i run a macro in the sheet1and manually copy the rows from sheet1 {starting (A2:AI2)} and paste as values it in the sheet2 {starting (A2:AI2)}.

Then I ll delete the available datas in the sheet1 and will run a macro for different customer.

Again I need to repeat the same action (manually copy and paste the datas to sheet2) without replacing the existing data in the sheet1.

In simple I require a macro code where it copy the available information in sheet1 and paste it as values in the sheet2 without replacing the existing one.

View 14 Replies View Related

Excel 2003 :: How To Amend Existing Code In Workbook

Feb 3, 2013

How to amend existing code in a workbook that is used by many different users. I am working in Excel 2003. The existing code copies data from certain cells in the active worksheet (which is password protected) into a new worksheet and saves that new worksheet to a temp folder, sends it to a particular email address using outlook and closes it, returning the user to the first workbook. You will see that it also unhides then rehides columns of the first worksheet during this process so that the user never has to see them. Problem here is that none of the users are using outlook anymore and I would prefer that this new spreadsheet that is created just be saved to the users desktop. I have found bits and pieces of what I needed on the web, but I can't seem to put it all together (I usually end up being sent to the debugger just short of having the newly created spreadsheet saved to desktop). Here is the existing code:

Private Sub CommandButton1_Click()
Range("A2:G2").Select
Selection.ClearContents[code]....

Essentially what I need to do is circumvent the whole email bit and save the spreadsheet that is created to the users desktop instead of a temp folder.

View 2 Replies View Related

Making Existing Code Work For Specific Worksheet/s

May 30, 2013

I would like the following code to be run for all those sheet/s that has a name = "single" (Not case sensitive neither an exact match) of my active workbook.

Code:
Sub UIUIUI()
Dim LR As Long, i As Long
LR = Range("I" & Rows.Count).End(xlUp).Row
For i = 1 To LR
With Range("I" & i)
If .Offset(, -1).Value = 1 Then .Value = .Value & "-"
End With
Next i
End Sub

View 3 Replies View Related

Add Stipulation That Specific Cell Must Not Be Blank To Existing Code

Oct 21, 2013

I have a code now that in excel, when the button is clicked, will put file into a new email and format the email.

What I have been trying to do, is make it so that if Cell C10 is blank, you get a prompt telling you it must be filled out before you can proceed with the submission.

Here is the code now:

Sub SendTimeCard()
On Error GoTo err_handler
Dim OutApp As Object
Dim OutMail As Object

Dim subject As String
Dim body As String
' Be sure the workbook is saved first
ThisWorkbook.Save

[Code] ........

View 2 Replies View Related

Update Existing Code To Include Two More Fields Of Info

Jun 6, 2014

I have some existing code which I did not write, nor do I have the expertise to update. The macro code takes multi rows of data for one person and "flips" the output to be one record per person with columns of data.

The source data looks like this sorted by teacher, Term and Period (columns H and I are the new ones added; the code currently looks through column G only)A

Faculty Name
B
Periodc
C

[Code]......


I just want to add column H and I data to the period course listings by term. So instead of "Term: TM#", just have the display indicate Termcode: Tally/SectSize.... such as (example): "TM1: 20/30"

My Code is as follows:

Option Explicit
Dim wsSource As Worksheet
Dim wsTarget As Worksheet

[Code].....

View 1 Replies View Related

Assign 2 Macros To 1 Button (or Adding VBA Code To The Existing Macro)

Dec 23, 2009

I'm verrry new to editing VBA code and I've been trying to figure out how to send a column of data ("Min Data" AB3:AB21 from "Sheet1") to a worksheet ("F4" - Min) and sending another column of data ("Max Data" AC3:AC21 from "Sheet1") to a different worksheet ("F4" - Max) by using only the one button ("Record Data" from "Sheet1"

I've been trying to figure out ways to edit the VBA in "Module 1" to make this work

Can anyone help me out here? If what i'm asking for isn't clear enough, just let me know and i'll try to explain in more detail.

View 6 Replies View Related

Enhance Existing Code To Hide Rows Between Specific Text

Mar 24, 2014

I have a workbook which contains 8 worksheets. I want to able to run a macro that looks for specific words in column A of each worksheet and hides any rows in between the specified words. The following code works except if a worksheet does not contain the specified words. Is there a better way to accomplish this?

Attached is an example of the spreadsheet. The code below works just fine on the tabs highlighted in green, but halts on the tab highlighted in red. The tab highlighted in yellow is showing you the rows I need to hide.

Example.xlsx‎

View 5 Replies View Related

Running Code On SharePoint Linked Worksheet To Update Existing And Future Data

Aug 8, 2012

I inherited a spreadsheet to manage that is linked to a SharePoint table.

It is trying to populate a date that a certain "Tier" is selected (1, 2, 3, or 4).

It works great if I manually type in the tiers, but does not run on existing data (about 400 records) or lines that are updated and new via the SharePoint list.

How can I have this run on all of the existing lines and anything added or changed in the future from the list?

VB:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("AD2:AD10000")) Is Nothing Then
Application.EnableEvents = False

[Code] ....

View 9 Replies View Related

Control Code Input ?

Nov 7, 2008

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?

View 2 Replies View Related

Security Code Input

Dec 7, 2009

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!

View 14 Replies View Related

VBA Code Using Input Boxes?

Nov 7, 2011

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.

View 9 Replies View Related

Input Box Result To Be Used In Code

Aug 4, 2006

I 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 Replies View Related

Input Boxes In VBA Code

Aug 8, 2006

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 Related

Changing Vba Code With Input Box

May 10, 2007

Is 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.

View 9 Replies View Related

Date Code For Input Into MsgBox

Feb 1, 2009

I have made a MsgBox which opens on Workbook opening with a message as follows:

View 4 Replies View Related

Modify Code To Have Popup Box For Input

Jun 12, 2009

I 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)

View 9 Replies View Related

Colors The Zip Code That Matches The One Input

Aug 4, 2009

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 Related







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