Launching Macro Based On Selected Cell Value (first Two Characters?)

Sep 6, 2013

I have a macro to sort a very large list of materials by a variety of conditions.

The macro runs automatically when a cell on the master list spread sheet is selected and using If/ElseIf it sorts based on what cell they have selected.

Example
If ActiveCell = "ALUMINIZED" Then
ActiveSheet.Range("$A$14:$K$1945").AutoFilter Field:=2
ActiveSheet.Range("$A$14:$K$1945").AutoFilter Field:=4
ActiveSheet.Range("$A$14:$K$1945").AutoFilter Field:=1, Criteria1:= _"Aluminized"

Which is working perfectly. The problem I am having is that some of the cells are two lines so it looks like this:

BE
BEARINGS

I don't know how to get it to launch based on that cell content because of the line break in there. Can I make it launch based on the first two characters only?

View 5 Replies


ADVERTISEMENT

Macro Based Off Of Selected Cell

Nov 2, 2012

I am trying to create a macro that runs only if the user has selected a cell in column "D". I want it to fill in the background color of the selected cell and then make the value of column "M", row "whatever row the selection is on" = 1.

How to change the background color, but am unsure how to accomplish the other two tasks.

Code:

Sub Macro1()    
With Selection.Interior        
.ThemeColor = xlThemeColorAccent3
End WithEnd Sub

View 2 Replies View Related

Call Macro Based On Selected Cell Value?

Dec 27, 2012

code to do the following:

If any cell in range T75:KH1000 is selected whose value is "Exit", call the macro named View6.

(There are about 40 non-contiguous cells in this range whose value is "Exit".)

View 2 Replies View Related

Move Selected Non-consecutive Text Characters From One Cell To Another

Feb 27, 2014

I am trying to select and move text from one column to another. I have roughly 1,000 cells in column A and I would like to tell Excel to select characters at certain positions and move them into the adjacent column.

I want it to look like this...

column A column B
ABCDEFGHI BCI

Each cell in column A has a 9-letter sequence. I would like to move characters 2,3 and 9 into the adjacent column

View 2 Replies View Related

Launching Pdf Files In A Macro

Dec 17, 2008

I have a macro that launches word or excel files if the file address (e.g. C:Documents and SettingsHenryDesktop est.xls) is typed into cell A1 by looking at the last 3 letters of the file name.

I cannot find a way to enable it to launch pdf files as well (e.g. C:Documents and SettingsHenryDesktop est.pdf)

View 12 Replies View Related

Launching Macro Recorder Using VBA

Jun 9, 2009

I hide all Excel standard tabs and thus need a button on custom tab to record a macro. (I did this successfully with custom menu in Excel 2003.) In 2007 ribbon, I've reused the code for a button's OnAction, now going to callback that runs:

Application.CommandBars.ExecuteMso ("MacroRecord")

In Excel 2003, the stop button appeared automatically for me. But in Excel 2007, with hiding standard tabs, etc., I see no way to stop recording, other than running my button to return the Developer's tab, where the Record Macro button has changed to Stop Macro.

I'd like to either add a second button to my ribbon to stop recording the macro (but I can't find an idMso to use in a callback) or have my Record button change to Stop button, like Excel does. But I can't come up with correct code.

View 4 Replies View Related

Launching A Macro That's Stored In A To Be Opened

Nov 15, 2007

Sub test12()

Set wbABC = Workbooks.Open("C:ABCwithMacro.xls")
Call abcMacro 'this macro is stored in ABCwithMacro.xls
'error - sub or function not defined on 'call abcMacro'

End Sub

View 9 Replies View Related

Run Macro Procedure Based On Drop-Down Item Selected

May 27, 2009

I am trying to accomplish is to display a dropdown or combobox with a list of choices. I want the backcolor to be shaded light green to match instructional text that appears in the cell above. That I have working with the selections appearing. Once a choice is made I want a separate procedure to run that will somehow know which choice was made.

I can't put the code within the module for this particular sheet as it is dynamically recreated each time the data is refreshed and the code will disappear. This may seem to be an odd practice but this is how 25+ workbooks are coded within this system for my employer's customer and it is a required practice.

View 9 Replies View Related

Delete Row Based On First 4 Characters Of Cell

May 4, 2006

I need a way to check to see if the first four characters of cell A1 is = 2006. If it is, do not delete the row, else, delete the row. Have tried everything I can think of.

View 5 Replies View Related

Name File Based On First 2 Characters In A Cell

Aug 11, 2006

I'm trying to find a way to save a file based on the contents of cell A2. I've modified the code to Create Worksheets for Each Item in an Excel Table of Data, so that it creates a new workbook for each item. I am also trying to get it to save the master workbook based on the first 2 characters in the cell. Here is the code I have, at the moment (the FAIL.xls is what I put in for testing)

If Range("A2").Value = "YE*" Then
ActiveWorkbook.SaveAs "YE_Master.xls"
ElseIf Range("A2").Value = "NE*" Then
ActiveWorkbook.SaveAs "NE_Master.xls"
Else: ActiveWorkbook.SaveAs "FAIL.xls"
End If

I've tried this, string arrays and everything else I can think of, and it's failing every time.

View 3 Replies View Related

Restrict Cells Text To X Characters Based On Corresponding Cell

Apr 14, 2009

I'm am trying to restrict the length of data that can be entered into a cell based on a drop down in that row. I have achieved this, but what I need to be able to do is use data validation to restrict the cell length to one of two values - so for example the length can only be 6 OR 9 characters long.

I cant see how to do this. At present the best I can do is rectrict to between 6 and 9 - but this would allow 7 and 8 which is not allowed.

View 3 Replies View Related

Changing Cell Value Based On Selected Row.

Jun 8, 2009

Is it possible to select a cell on any given row and the value of a cell on that row for example C5 & C6 are shown in cells A1 and B1 respectively? So if the user moved down the sheet selecting different rows the data would change?

View 4 Replies View Related

Excel 2013 :: How To Translate All Characters Of Selected Cells To Unicode

Apr 19, 2014

In Excel 2013, how do I translate all characters of selected cells to Unicode?

There is a formula to translate the first character into Unicode [=UNICODE(text)] and that formula would have worked fine for me .Only if it could translate all the characters to Unicode not just the first one.

View 1 Replies View Related

Excel 2013 :: Translate All Characters Of Selected Cells To Unicode?

Apr 19, 2014

In Excel 2013, how do I translate all characters of selected cells to Unicode? There is a formula to translate the first character into Unicode [=UNICODE(text)] and that formula would have worked fine for me .Only if it could translate all the characters to Unicode not just the first one.

View 10 Replies View Related

Macro To Remove Certain Characters - End Of Cell Value

Jun 9, 2014

I am currently using the following formula to remove the letter "R" from the end of cells

[=IF(ISNUMBER(--RIGHT(A3)),A3,LEFT(A3,LEN(A3)-1))].

However, I would like a macro to accomplish this goal, along with something else. I have a list of values as follows:

CHD152-2
CHD115-1
CHD40-3
RE224
HPC644R
DOC020R
HPC594R

What I need is a macro that will remove any instance of "R", "-1", "-2", "-3", "-4" from the end of a cell. neither of the 5 values listed in the last sentence are present, the the cell will be unchange. So, after running, the above values would look like this:

CHD152
CHD115
CHD40
RE224
HPC644
DOC020
HPC594

View 8 Replies View Related

Finding Cell Based On Text In Currently Selected Cell?

Jan 25, 2012

Macros question - The user enters a word, e.g. Malaysia in a particular cell (always the same location) and I want the macro to be able to find the next cell with that word in it, but it appears that when using macros you can't paste anything into the find function, so was just wondering what to do!

View 1 Replies View Related

Deleting Selected Data Based On Cell Value?

Oct 23, 2013

I have attached a sample file.

There are two sheets Stock and BrancnID The stock sheet has a very huge date ( approx 30000 ). The Stock Id of all the records are unique. Every day I get the Stock ID numbers only in excel format from different branches. Every day I have to match the ID numbers received and delete its data in the Stock sheet ( to get an idea I have shown this in sheet3 ).

Is there is any code where I copy paste the ID numbers from the varoius excel sheets into my excel file in the BranchID sheet and the data gets deleted. i.e as I paste the data the record gets deleted but not the Stock ID number. Also the next day when I get new ID numbers and I delete the old ID numbers from the BranchID sheet the data should not re-appear in the Stock sheet.

View 4 Replies View Related

Checking Number Of Characters In Cell Macro?

Mar 6, 2009

i have a problem counting the number of characters in each cell in column "A" in a sheet and checking if number of characters in a cell exceeds 5 characters.

View 10 Replies View Related

Macro Code To Take Out Last Characters Of Text In Cell

Feb 27, 2014

In an active cell I have this value : " Hello.xlsm"

I need a MACRO code that will take out the characters ".xlsm".

I am trying to focus on the active cell and not a range.

View 3 Replies View Related

Checking Number Of Characters In A Cell Macro

Mar 6, 2009

i have a problem counting the number of characters in each cell in column "A" in a sheet and checking if number of characters in a cell exceeds 5 characters.

View 8 Replies View Related

Macro- If 46 Characters In A Cell, Text Wrap

Sep 2, 2008

Is there a way to specify if there are 46 characters in a cell, to apply text wrap, indent the second line, and resize the row height to 25.5?

For example, I always will have text on merged cells B7:C7. I'd like to have a macro that determines if the text goes over C7 (I figured that it would take 46 characters to do this), that the merged cells will be text wrapped, then row 7 will be resized to 25.5.

I know how to record a macro that will text wrap and resize the row height but am not sure how to do the "if" condition.

View 9 Replies View Related

Run Macro When Cell Is Selected

Jan 30, 2006

I just want to run a macro when a certain cell is selected.
upon investigation, i have found that I can right click on the sheet tab and
view the code. I can then add the following
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$a$1" Then
run(macro1)
end if
End Sub

View 9 Replies View Related

Run Macro When Cell Selected

Jul 18, 2006

I've seen plenty of code for running a macro when various events occur, but how do I run a macro when a cell is simply selected? I have a calendar Macro, and there are two cells that need date input. I want the user to select the cell, and the calendar to pop up. Macro for the calendar works correctly, just need the code for the activation upon cell selection.

View 9 Replies View Related

Macro - Rename Only & Sheet... & Tabs With Last 8 Characters From Cell

Nov 5, 2009

I pull an excel sheet from a database each day that gives me sales data for different products sold. The way the spreadsheet comes from the system, the first tab is named "Document Map" and lists all of the products, and each product then has its own tab but they're generically named (Sheet1, Sheet2, etc.). The name of the product is always in cell T8, but the name itself is only the last 8 characters of that cell.

What I'm hoping to accomplish with a macro is two things:

1) Retrieve the last 8 characters from T8 in each tab, and name the tab with those characters (same effect as the formula "=right(T8,8)").
2) Ensure that this only occurs on tabs with the word "Sheet" in the beginning. Depending on the day, there could be any number of products and they each get their own tab, so I was hoping to be able to get the macro to only work on sheets where the first 5 characters are "Sheet" regardless of the number after that.

View 9 Replies View Related

Change A Macro To From And Absolute Cell Reference To Selected Cell.

Feb 5, 2010

i am currently using the macro below to import text files into a spreadsheet. Currently, it begins the import in cell A1 which is what I recorded it to do. how do I change the code to begin the import on the active cell?

View 2 Replies View Related

Macro To Add Character To Selected Cell?

Jun 3, 2014

I am trying to create a button that when clicked it will add a character to the existing cell. Eg if cell had LDs and I click button I like it show LDs₂

The ₂ is character code 2082.

View 5 Replies View Related

Macro: Select Cell A Of Selected Row

May 4, 2009

Currently working on a project for university and still learning how to use macro.
Got a problem which im sure is an easy solution for all you experts out there. As shown in the picture; http://img300.imageshack.us/img300/1205/macrohelp.jpg. When the Sap number is entered (from A19 and onwards), it copies the value to cell B10. The general code is used below.

View 2 Replies View Related

Copy Selected Cells From Sheet1 And Paste Them In Sheet2 Based On A Cell Value?

Dec 27, 2012

have two worksheets, "Entry form" and "Database" in my workbook. I am trying to put together a macro button to find the cell value D5(Entry form) in the column A:A (database), if found, copy selected cells (B5:D5,B7,B9) from entry form and paste in the adjacent cells of the row with the value in the database sheet.

VB:
'Match value D3 and replace data
Dim sht As Worksheet, outsht As Worksheet, r As Long
Dim rfoundCell As Range

[Code].....

View 9 Replies View Related

Produce List Of Row Data Based On User Selected Cell Criteria?

Apr 7, 2014

I have a workbook that has three worksheets. The ASU Database sheet contains part numbers and descriptions including specific details that are selected from pull down data validation lists that are named on the third worksheet. I want to have a front end on the first worksheet that has similar data validation lists for the user to select from to create a search criteria that will create a worksheet with only the rows that meet this criteria. I am not sure what method to use to accomplish this.

View 2 Replies View Related

Macro To Copy Selected Cell And Paste Value

Mar 31, 2014

I use few cells with formula and I would need when I click on the cell to run a macro that would copy the selected cell and do a paste value.

View 2 Replies View Related







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