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.

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


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

[Code] ........

View 2 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.


View 5 Replies View Related

Open All Excel Files In Directory - Code Doesn't Work For One Specific Path

Feb 8, 2014

I have my code here:

Sub openfiles()Dim Path As String
Dim ExcelFile As String
' Path = GetFolder("C:UsersKinteshDesktop")
Path = "C:UsersKinteshDesktopVBA programmingMaps"
ExcelFile = Dir(Path & "*.xls")

[Code] ....

GetFolder = sitem
Set fldr = Nothing
End Function

My problem is that the code all actually works (including the function and when I use the commented part), but pointing to this one specific directory (the one I'm using right now), literally nothing happens.

View 6 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?

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

Copying A Certain Range In A Work Sheet To Another Existing Work Sheet Using VBA

Dec 29, 2009

I have a range of cells in a work sheet "sheet 1 " my objective is to filter this range according to certain criteria (i ve succeeded to do this ) yet what i want to do now is copy this data to another existing worksheet in a certain range .

note :the existing worksheet to which i 'll copy the filtered data has some cells out of the range that i dont want to over write ..

Simply :how to copy a selected range of cells in a work sheet to already existing work sheet in a specific range aswell .

View 9 Replies View Related

Macro - Making Extensive Action Items Log For Work

Apr 11, 2012

I am trying to make an extensive action items log for work.

On Sheet 1, rows 1-3 are blank. Row 4 contains column headers.

Column A: Item #
Column B: Description
Column C: Drawing #
Column D: Conforming
Column E: Nonconforming
Columns F, G, H don't really matter

What I am wanting is to be able to put an "x" or check mark in either column D or E (conforming or nonconforming). Then I want to run a macro with a push button (I know how to make these) that when pushed scans the spreadsheet row by row until it finds the "x" or check in Column E. I want it to copy every instance of this and send it to an Action Item Page that I have temporarily called Sheet 2. (This way I can go here to see all nonconforming issues). I do not want it to remove the information from Sheet 1.

Then, I want to be able to change the "x" or check on the Action Item Page to Column D (back to conforming) and the macro (push button preferably) copy and send that information back to the original spreadsheet in the SAME row it was.

So, in short I want this to be a fluid way of checking off a punchlist of items.

To complicate things even further, if possible, I would like to have several worksheets send information to the one Action Item List rather than just the one.

View 2 Replies View Related

Excel VBA - Applying Code To Specific Worksheet?

Jul 23, 2013

I have a number of different modules. Each module does something similar, but different to a specific workbook. Instead of running the macro(s) individually is it possible to have a parent-class that calls on each module, and further to have each module *know* which worksheet it should apply to?

Example below:

Sub Cost_Center_Information_File()
'What it does: applied to a worksheet (there are about 15 worksheets in the workbook) it
'will do some formatting manipulations.


View 4 Replies View Related

VBA Code For Selecting Specific Cells Within Worksheet?

Aug 28, 2013

know the VBA script to select only specific cells within a worksheet. To be more precise, on sheet 1 - A2, A6 and A10 cells are filled with red color. I want only those cells which are highlighted in red to be selected, copied and pasted to sheet2.

View 3 Replies View Related

Macro Code Only Works If Specific Worksheet Active

Apr 30, 2008

I have searched the FAQ's but have not found a suitable answer to my problem. I have some code that works perfectly when it is run from the VB Editor but when I put it behind a command button it gives me an error almost straight away. I have read that when a command button is used the command button defaults the active sheet to the one that it is one therefore you always have to specify the active sheet but I have done this so am still confused as to why it is falling over. Below is my code, I have commented where it is tripping:

Sub FormattingAcutalReport()
Workbooks.Open Filename:="H:Risk ReportingDaily TemplatesMF Consolidated Risk DAILY LIVE DATA FROM BO.xls"
Workbooks.Open Filename:="H:Risk ReportingDaily TemplatesDaily Non Banks LIVE.xls"
Dim myBorders() As Variant, item As Variant
Set SEGNSEG = Workbooks("Todays Reports.xls").Worksheets("Seg and Non Seg Bank Summary")............................

View 2 Replies View Related

VBA Code For Adding A Specific Worksheet Condition Within Subfolder Consolidation Macro

Aug 22, 2013

The issue is the I want to put the condition here in my the code that only copies the desired cells if the sheet is named specifically such as "Jan", if not named as this the worksheet should not be used. The current code I am using was posted on this site in 2009: VBA to copy specified cells from all the files in a folder

My modified code is:

Option Explicit
Public strSourceFldr As String
Public EachFile As Object
Public objFSO As Object
Public objFolder As Object
Public objFile As Object
Public strSheetName As String

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

View 1 Replies View Related

Pivot Table - New Worksheet Auto Create To Right Of Existing Worksheet

Sep 2, 2013

The new worksheet is created to the left of the existing source worksheet.

View 2 Replies View Related

Add A Worksheet To An Existing Spreadsheet Which Has VBA Behind It, But The Worksheet Is Password Protected

Aug 23, 2006

One of my work colleagues need to add a worksheet to an existing Excel Spreadsheet which has VBA behind it, but the worksheet is password protected. The developer who wrote the application has now left, so we have no idea what the password is. Is there anyway of getting round it, like cracking into the spreadsheet to find out the password, or another way?

View 2 Replies View Related

Create New Worksheet From Form Vs. From Existing Worksheet

Feb 11, 2009

I have code in a worksheet that creates a new worksheet when clicking a button:

View 3 Replies View Related

Ebay / Amazon Profit Calculator - Making Specific Margin After Fees?

Feb 3, 2014

I don't want to appear too expensive or give my products away. If I have a part that costs me £20.00 plus vat i.e £24.00. I have to include carriage £5.00 plus vat i.e £6.00. Ebay fees for car parts including PayPal is 10%. How much would I charge to retain 20% percent after all fees and charges and what formula would I use to make the calculator.

View 2 Replies View Related

Making Code Efficient

Dec 29, 2009

following code be write down in more efficient manner :>>>

Range("B3") = Range("L" & Target.Row)
Range("C3") = Range("O" & Target.Row)
Range("D3") = Range("Q" & Target.Row)
Range("E3") = Range("R" & Target.Row)

View 9 Replies View Related

Making Code Available To Other Workbooks

Jul 13, 2006

I have written a sub that will compare the data in one colum to the data that i paste in another colum, when it finds a similarity it deletes the row. Everything works fine, but the file that needs to run the code will be changing every month. how do i export or package to use in other sheets. Also what command will i need to insert to get the new sheet to run the code.

View 7 Replies View Related

Converting Hex To Dec In VBA And Making Code Efficent

May 12, 2009

Wondering where this code can be adjusted to be much more efficient. Right now it is going through 1000 rows and 14 columns and it is taking about 10 minutes. I eventually need it to go through 6000 rows and 32 columns..

I already stored the HexToDec(Cells(x, 1)) result to variable H2D and it didn't really make too much of a noticeable difference.

View 14 Replies View Related

Making Code Run With Cancel Option?

Mar 26, 2012

I have a macro with a vbYesNo in it currently, I tried adding cancel as an option (vbYesNoCancel) but ran into some issues. aMaking my code run with the Cancel option? All I need is to have the cancel option there and have the sub end if cancel is selected.

Sub Sendit()
Dim lr As Long
' Conformation Box for Daily Sales Report Date[code]......

View 7 Replies View Related

Trying To Import Specific Data From A Separate Sheet To Add To An Existing Table

Apr 25, 2006

I'm trying to set up a macro which will import data from one worksheet to a master sheet. I need it to copy the information into specific columns but not overwrite any existing information which is already in the Master Sheet, but I don't even know where to begin.

Just so you're clear on exactly what it is I'm trying to do... I have a Master Sheet which lists all of our suppliers prices, margins etc etc... However, when we use a new supplier we send them a greatly condensed version of the Master Sheet - We call it the Supplier Sheet (no big surprises there)!

When the supplier sends it back to me I have to type it all out manually which is kinda time consuming. I'd really like to set up a "push button" system which allows me to simply drag the Supplier Sheet into the workbook, add the info into the Master Sheet, then be able to delete the now useless Supplier Sheet.

(I have attached a test copy of the file - all of the columns in blue are the ones which need the data adding to).

View 6 Replies View Related

Function Making Worksheet

Apr 24, 2008

I'v got a school task about making a excel worksheet.

But we have just started and i havent gotten all the functions to work yet.

The task itself is :

Make function that tests if D9 is larger then 100 and I9 is less then 50. If true "Kontroll" if not "OK" should be written.

Also, if "Kontroll" shows up it should have a dark green "OK " should just be black

Its roughly translated from norwegian. If you need some more information I will try to provide it

View 10 Replies View Related

Making One Worksheet Talk To Another

Dec 8, 2008

I know I posted this same topic about a week ago but I went through the first 20 pages on the forum and couldt find it, i tried the search option and nothing came up. I have several worksheets in the same workbook. When I enter a number in one cell in work sheet A, I want the same number to show up in a given cell on work sheet B. How do I do this? I can make words move from one shet to the next but numbers dont seem to be the same.

View 6 Replies View Related

Making Worksheet Active With Macro

May 12, 2006

Basically trying to make change the active worksheet using a macro code. I want the user to be able to click a button and it will automatically switch the worksheet to another within the workbook.

View 5 Replies View Related

Trying To Combine Existing Code

Mar 27, 2009

I am trying to combine the 'Mail Range' from this code with the 'Mail to address in A1' from this code 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

Making Filepath Hyperlink In Email Generated With Code

Mar 14, 2014

I have the following code to do something similar to above but I need to add the filepath as a hyperlink to the email along with the body text. I have 4 cells in the Excel workbook that contain 1) Who to sen to:, 2)The Subject:, 3) A sentence for the Body of the email and 4) The filepath of the workbook as a hyperlink.

I want to add both the Body text and the hyperlink to the email so that the person opening the email can click on the link and open the file.

[Code] ....

View 10 Replies View Related

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

Adding Second Range To Existing VBA Code?

Nov 13, 2011

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

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


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

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

OpenText Into Existing Worksheet?

Sep 26, 2006

I would like to Import a Text file into a current Workbook with the worksheet name GLFBCALO. The macro below creates a new workbook instead of imported the data to existing sheet, GLFBCALO. Is there a way to use the OpenText method to import data into an existing worksheet?:

Public Sub ImportOKdata()
Dim MyFile As String
Dim ColumnsDesired


View 3 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

Copyrights 2005-15, All rights reserved