Adding Second Range To Existing VBA Code?
Nov 13, 2011adding an second range (J1089:AI1147) to the follwing code.
Code:
Sub Clear_Range()
Application.EnableEvents = False
With Range("H3:AL1058")
[Code]....
adding an second range (J1089:AI1147) to the follwing code.
Code:
Sub Clear_Range()
Application.EnableEvents = False
With Range("H3:AL1058")
[Code]....
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.
Is there any way to automatically add two new rows after every existing row containing data?
For example
1 A B C
2 D E F
3 G H I
turn into
1 A B C
(empty row)
(empty row)
2 D E F
(empty row)
(empty row)
3 G H I
I want to add a number to existing set of numbers.
E.g. 10035-TSZ651-MT0A01-42004314-F01-023
and i want to add 0 to 023 so that the number will be
10035-TSZ651-MT0A01-42004314-F01-0023.
I would like to add a pause to the following macro so that it inserts the word CANCEL 1 second after triggering. I know I need to use the Application.Ontime function but cannot work out how to integrate it.
Code:
Sub Cancel() Application.ScreenUpdating = False
Sheets("Sheet1").Range("T5") = "CANCEL"
Application.ScreenUpdating = True
End Sub
What I missed. I already added the MS VBA Extensibility 5.3 on a VBA Reference. but still got an error.
Line1: Dim objForm as object
Line2: Set objForm = ThisWorkbook.VBProject.VBComponents("UserForm1").Designer
Line3: Set Butn = objForm.Controls.Add("Forms.CommandButton.1")
The error is on Line3, "Runtime Error '91': Object Variable or With block variable not set".
I'm preparing Quarterly Evaluations, and am having an issue because an Analyst has superseded an overall percentage goal. In the attached example, it is the overall evaluation with the 'problem data' in red D19 and highlighted.
I'd like to add a condition that limits the points in D19 for 'responsibility 3' to 150.
=IF(ISERROR(C19/B19)*(B10),"-",(C19/B19)*(B10))
*just a note for clarification, the other two responsibilities are a 'per hour' weekly goal, whereas the 3rd is an overall personal effort divided from the overall team effort.
I have a spreadsheet of over 8000 addresses. I have the street, state and zip but not the cities.
Is there a way I can do a search and mass import of cities from a website, like USPS? I'd like to know if there is something I can do quickly rather than manually look each zip code up and enter it in one by one.
In the attached workbook I have 3 sheets. The first 2 with the names starting with WO are individual sheets based on a single scaffold rental. The "Standing Equipment" worksheet is adding the components from the other two worksheets. Easy enough, but I am looking for either a formula or some VBA guidance on how to have the "Standing Equipment" worksheet automatically change it's formulas to incorporate new worksheets as they are either added or deleted, thus avoiding constant formula editing as scaffolds are erected or dismantled.
View 3 Replies View RelatedI'm currently doing a new worksheet for work
Cell's A1: Commission Per Sale Cell B1 Running total of commission
I would like the running total to continuously incorporate all of the above commissions and this has to be in the column next to the new sales commission.
E.g.
Commission $5 $7 $9
Running Total $5 $12 $21
I run the following formula down a column of records in row AR
=IF(COUNTIF(lookup!A:A,N2)>0, "Exclude", "Not In Lookup")
I want to add to this formula an additional function that if any cells in column A1 are blank, then do not perform the remainder of the equation.
I'm currently using the following formula to return values rounded down to the nearest 2.5: =FLOOR(X8*1.25,2.5)
This works fine but I would like to put in place a system where if the "X8" value is 1 the formula produces a 2.5, and if the "X8" value is 10 or greater the formula produces a 10.
In a workbook made in Excel 2003, I have the following for a UserForm:
Private Sub UserForm_Activate
Me.Calendar1.Value = Date
End Sub
I copied this workbook to a computer with Excel 2007 and it bombs out at "Date"
It comes up with a compile error, "Can't find project or library"
In the references window (Tools, References) it has the "Missing: Ref Edit Control" checked and the location at the bottom of this window states "C:Program FilesMicrosoft OfficeOffice11REFEDIT.DLL".
The reference to Office11 is from the computer with Office 2003 as the computer with Office 2007 has Office12.
There is another "Ref Edit Control" in the References window and when I check it and browse to the Office12 folder, highlight REFEDIT.Dll and click on open and in the references window on OK it comes up with "Name conflicts with existing module, project or object library". I have tried to delete the "Missing: Ref Edit Control", change the priority and change the reference in the missing control to Office12 but all to no avail.
How can I change the reference to the Ref Edit Control from Office11 to Office12?
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 RelatedOn 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 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] .........
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).
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.
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
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..........................
I have created a population pyramid and want to add another chart on the secondary axis which I can do. The part which I seem not to be able to complete is getting the line chart secondary axis to read from the primary y axis. It seems to add a new axis, even when I delete this the line chart does not read correctly.
View 1 Replies View RelatedAttached 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.
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.
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.
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
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] ........
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].....
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
I am now trying to combine 2 sections of code but being a complete VBA novice I'm stuck, where should the second Sub go so that it works,
View 4 Replies View RelatedI 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] ....