Macro For Formatting Selected Cells?
Apr 11, 2014
I've made a push button on the sheet. By selecting a couple of cells and then pressing this button I want to change the background color of the selected cells as well as add some text (same for all selected cells).
View 9 Replies
ADVERTISEMENT
Apr 18, 2012
Column A = list of names
O1:P20 MAY contain names
If A1 = Fred
AND O5, O16, P3, P19 = Fred
Selecting A1 changes all instances of "Fred" to RED-BOLD
If A2 = Felix
AND O9 = Felix
Selecting A2 changes "Felix" to RED-BOLD
Etc...
View 4 Replies
View Related
Apr 17, 2014
Just started using Macros on Excel.
I recorded a Macro that would take a value of a particular cell and add that value to the selected cell in the same row. However, this macro just runs on one cell and I want it to run on the entire row.
This may seem like a trivial issue but I've been racking my brain for the last couple of days to figure it out.
Here is the VBA code of the Macro I recorded. It adds the cell value to another cell with formulas already in it as you will see below:
Sub SpreadingTest15()
'
' SpreadingTest15 Macro
'
'
ActiveCell.FormulaR1C1 = _
"=IF(MarRF!RC9=""Trade"",IFERROR(IF(RC12=""BL"",RC13/12,INDEX('Variable Data'!R4C2:R16C17,MATCH('1410-Rev'!RC14,'Variable Data'!R4C2:R16C2,0),MATCH('1410-Rev'!R14C,'Variable Data'!R4C2:R4C17,0))*RC13),0),IF(RC14=R14C,RC13,0))+(RC35)"
ActiveCell.Select
End Sub
View 4 Replies
View Related
Apr 28, 2009
I am looking for a macro or function (VBA) that will modifiy the value of the selected cell or cells. the code should support selection of one cell, a range or multiple ranges.
I envision the user making his range selection(s). Activating a function or clicking a button that would pop open a modal window. The user would have the option to either adjust the values by a % change (i.e. up or down 7%), or incremental change (i.e. up olr down 100 units). The function would overite the value in the cells.
Has anyone ever done something similar? Is it hard to program?
View 14 Replies
View Related
Jul 6, 2009
i m trying to set up a macro to convert a range of user-highlighted(selected) cells to 3 significant figures: for example, convert 0.135564 to 0.136
the equation i found elsewhere online: ROUND(xx,3-(1+INT(LOG10(ABS(xx))))). but i can't quite figue out how to apply the equation to a selected range of cells via a macro.
View 5 Replies
View Related
Jan 20, 2006
I have a worksheet with ever expanding data - rows at the bottom of the data
are continually added. I have a simple macro that sorts all of the data
according to preset parameters and selects the next blank cell in column A,
ready for more data:
Sub Macro5()
Range("SortRange").Select
Selection.Sort Key1:=Range("SortRange"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom
Do Until ActiveCell.Value = IsEmpty(True)
ActiveCell.Offset(1, 0).Activate
Loop
End Sub
When running the Macro, this leaves all of the cells in the range 'selected'
(ie; coloured-over). What do I need to add to the Macro to just select the
cell in Column A and remove the highlighting from all the other cells?
View 9 Replies
View Related
Mar 27, 2012
The concept is to have a user open a sheet that breaks down that current day into 15 minute blocks of time. Later, I will work to append that to an Access DB or to a master Excel sheet as I will have multiple engineers inputing times for multiple days. There are multiple paths for this....We don't have Access for everyone yet or I would look at that path now.
Right now I am trying to make the initial input screen easy to use so that they actually use it.
I want to allow the user to select multiple 15 minute blocks and then click a button that adds a specific value to each of those cells. For instance, they might choose 8 15 min blocks that are not necessarily blocked together (C5, C7:C10, C15, C20:C22) They would hit the "Project 1" button and "Project 1" would be inserted into each of those cells.
I have about (5) categories so I would simply have (5) buttons with the different inptu strings.
But how can I have a macro set the value for multiple selected cells? Ideally, they would not have to be blocked together but, if there is no other way, if I could have blocks of cells filled in all at once.
I am using Excel 2010.
only a few of us have Access but I will be the only one accessing the collected data. Besides, I would make Excel query the Access DB for more general use. I
View 2 Replies
View Related
Apr 26, 2013
I have a spread sheet with large number of data, problem is all are in various currency so rather than typing =#####.##/a1 in every cell to get the GBP amount (a1 where my exchange rate is linked) I thought if there is macro can do this job for rme.
So what i need is macro which once run enter the formula after the numbers already in the cell in selected or given range.
View 1 Replies
View Related
Mar 18, 2014
How I can deselect the selected cells before ending the macro. Ihave a workbook containing about 40 sheets, and need to clear the same cells on 31 of them. I have attempted to define a name for the range, and actually got it to work once, however it ceased working on the second attempt, and I don’t know why. I have therefore gone back to the original code as posted below.
My questions are a) how can I deselect all the cells and b ) how can I use a defined name for the range so that I can use something like clear contents and not have to select the cells?
(I have also cleared all unlocked cells previously, but I have some unlocked cells in the other sheets I do not wish to clear).
Subnewmonth()
' newmonthMacro
IfMsgBox("This deletes all data, do you wish to continue?", vbYesNo) = vbNo Then Exit Sub
Sheets(Array("1","2", "3", "4", "5", "6","7", "8", "9", "10", "11","12", "13", "14", "15", _
"16", "17","18", "19", "20", "21", "22","23", "24", "25")).Select
Sheets("1").Activate
Sheets(Array("26","27", "28", "29", "30","31")).Select Replace:=False
[Code] ..........
View 8 Replies
View Related
Feb 5, 2010
I have figured out how to write a macro to make charts for me automatically, but it only runs the macro on the exact same range every time.
I have about 100 different students to make charts for and would really like to find a way to do it more automatically
Is there a way to write a Macro so that I can run the same steps on a different range (same number of rows and columns)?
Edit: having learned from my first post, I am adding more information.
the first chart is from the data in the range from B5-H7
the next chart would be from the data in the range from B11-H13
The charts are not evenly spaced from each other. I will need to select the range (same size) each time.
I can record the Macro, I just can't apply it where ever I want to.
View 14 Replies
View Related
Jun 17, 2013
I'm trying to create a macro that will change the color of the cells I've selected to green. My selection will vary depending on what cells I'm trying to color green (not a fixed range). My current code only changes one cell of my selected range:
Sub IN_PCA()
'
' IN_PCA Macro
'
'
ActiveCell.Select
Range("M243").Activate
With Selection.Interior
[Code] .......
I've tried using "ActiveRange" in lieu of "ActiveCell" as well as other commands that would seem to be correct but have failed.
View 3 Replies
View Related
Feb 12, 2014
write a macro - Condition: When i select "Audit Round" = "Round 1" in B2 and press a button it will automatically copy data from B5:B8 and paste special value in C5:C8. Likewise if I select "Audit Round" = "Round 2" in B2 then it should lookup "Round 2" in "Row 4" and paste special values from B5:B8.
Here an example:
A
B
C
[Code]....
View 1 Replies
View Related
Apr 5, 2009
I have a folder "D:Documents and SettingsRakesh", which has many .xls files. Each file has a sheet called 'Cover Note'. I want to copy cells B2, C2, D4 and F3 from 'Cover Note' of each file.
These cells should be pasted in the current sheet, one row for each file. First cell of each row should have the source file name.
It would be better if macro can prompt to select the directory where ther source files resides.
View 9 Replies
View Related
Jun 8, 2014
I have a dropdownmanu in sheet1 with different countries taken from Column A in Sheet3. I need a macro to run when i select a country example Denmark. It will fill out transmittal code and also country code in named cells for it in sheet1. Info taken from Sheet3
Transmittal code is in below testsheet in Sheet1 cell E12.
Country code is in Sheet1 cell.
But this have to be possible to change. Also the range for the country have to be possible to change.
This vba code i need to run as soon as i select a country in the dropdown manu.
But one thing i would like to solve also is. When i select a country it will create a dropdownlist in I13 taken from the info in column, i have in Sheet3 column F. So if i select example Denmark, it will show a dropdown menu in sheet1 I13, with the ledger codes 10 and 6x. I have tried to make this work but cant make it work good.
I use excel 2003. Please have a look and upload the testsheet back.
View 14 Replies
View Related
Jul 25, 2014
I am using this code to hide or unhide rows of text on another sheet:
VB:
Sub ProcessSheet1ChangeOnCellJ7(ByVal Target As Range)
Dim sAddress As String
Dim sValue As String
'Get the address of the cell that changed without '$' signs
sAddress = Target.Address(False, False)
[Code]....
When the "Not Pursuing" list box option is selected (in cell "J7" or "J8" in Sheet 1) I need to add (or over-write) "Not Pursuing" to the range of cells in column "B" (in the "Tasks" sheet), but only for that particular Goal, meaning a limited range of cells in column "B". If the "Pursuing - Show All Tasks" option is selected for a Goal then these same cells need to be blank so that the appropriate person can enter their name into the cell.
The purpose for adding "Not Pursuing" automatically to these yellow highlighted cells is that it will facilitate filtering of tasks by individual in the "Tasks" sheet..
Again I have tried several times to upload a sample file and am unable to, which I know makes it more difficult to solve. (Is there some common mistake people make? I know it's an allowed format and is very small in file size....)
Code solution can be entered directly beneath:
VB:
If Target.Value = "Not Pursuing" Then
ActiveWorkbook.Sheets("Tasks").Rows("29:29").EntireRow.Hidden = False
ActiveWorkbook.Sheets("Tasks").Rows("30:48").EntireRow.Hidden = True
View 1 Replies
View Related
Mar 26, 2014
I have the following code that allow me to select all of the cells with the color same as the active cell within a selected range:
Sub SelectCellColor()
Dim CellColorFormat As Long
Dim RangeString
[Code]....
I'd like to ask how can I fix the error so that there will not be a limit of the number of colored cells in a selected area?
View 2 Replies
View Related
Jan 6, 2012
I have an array which includes an if state as such:
for j = 0 to 5
for i = 0 to 10
if menu.value = "Class 1" then
Worksheets(currentsheet).Cells(startrow + j, startcolumn + i).Value = Class1_Schedule(j, i)
elseif menu.value = "Class 2" then
Worksheets(currentsheet).Cells(startrow + j, startcolumn + i).Value = Class2_Schedule(j, i)
else
Worksheets(currentsheet).Cells(startrow + j, startcolumn + i).Value = NightClass_Schedule(j, i)
next i
next j
I want to write some sort of formatting code within this forloop to say
if menu.value = "Class 1" then
position (j,1) = a number to 0 decimal places and position (j,2) has data validation lists.
I know how to use the record macro button but I dont want to code for fixed cells. I would like to use the forloop to do it.
View 2 Replies
View Related
Mar 11, 2014
I build a lot of spreadsheets at work that I email out and the person I send them too has to enter information in the cells highlighted in yellow. Since not many of the end users are too computer savvy I lock and protect all the cells that they shouldn't be changing.
This can take forever, is there any way to have all the cells in a worksheet become locked and protected based on the formatting they have? All cells that aren't yellow?
View 9 Replies
View Related
Nov 26, 2013
Attached is a workbook. I have manually highlighted the cells to give idea of what I would like the outcome to be.
Moonah OPS sheet.
In Row 5(Shift times), under the drop down menu in cells B5:J5, there is a range of Shift times.
And for the purpose of this I have selected
B5 as 0800:1621, manually highlighted B11:B27
C5 as 06:00, manually highlighted C7:C24
D5 as 07:00:1521, manually highlighted B11:B27
E5:I55(RDO, REC, SICK, Travel) can remain as manual input if it is to much to work out.
Is it possible or just a pipe dream, to use some method to automatically highlight a range of cells based on the C5:J5 'time'?
If the time is an actual shift time, the colour will be green and dark green writing as default, then we can allocate jobs/training/meetings and manually colour them.
Daysheet DAY MONTH YEAR template - Highlight.xlsx‎
View 7 Replies
View Related
Dec 9, 2011
I am building a spreadsheet with a column having two drop down menus at the top that designate independent, but strict conditions. For simplicity, say I have in cell A1 a drop down menu with choices "alpha, beta, gamma" while A2 has a drop down menu for "1, 2, 3". These six values sit off to the side in cells X1, X2, X3, X4, X5 and X6 respectively.
In cell A3 I woul like to change its color, perhaps to green because it is an acceptable number (say less than or equal to 100) or change to red if unacceptable, value greater than 100.
I can do both of these commands in Excel, no problem. In my situation, I would like to change the value at which cell A3 goes from green to red dependent on the options in A1 & A2. There are 9 such combinations of alpha, beta, gamma, paired with 1,2,3 and I would like the combinations to change the fill color of cell A3 in the following manner:
If A1 = alpha and A2 = 1, then A3 will be green for values less than or equal to 100 and red for values greater than 100.
If A1 = beta and A2 = 1, then A3 will be green for values less than or equal to 80 and red for values greater than 80.
If A1 = gamma and A2 = 1, then A3 will be green for values less than or equal to 60 and red for values greater than 60.
If A1 = alpha and A2 = 2, then A3 will be green for values less than or equal to 95 and red for values greater than 95.
If A1 = beta and A2 = 2, then A3 will be green for values less than or equal to 75 and red for values greater than 75.
If A1 = gamma and A2 = 2, then A3 will be green for values less than or equal to 55 and red for values greater than 55.
If A1 = alpha and A2 = 3, then A3 will be green for values less than or equal to 92 and red for values greater than 92.
If A1 = beta and A2 = 3, then A3 will be green for values less than or equal to 72 and red for values greater than 72.
If A1 = gamma and A2 = 3, then A3 will be green for values less than or equal to 52 and red for values greater than 52.
How to create a cell that can change its conditional formatting based on the selected values of two drop down menus.
I have a few other conditions I would like to implement, say change the fill color of A3 to green, orange or red dependant on the values in A1 & A2, but I might be able to crack that if I can see how the above scenario is done.
View 1 Replies
View Related
Sep 16, 2013
A little background on what i am doing. I have a spreadsheet that tracks when i have blown the dust out of our computers. I have set up conditional formatting so that the text turns red after 300 days and the cell turns yellow after 600 days. However, some computers are in high dust environments. I would like the spreadsheet to tell me to blow the dust out of these sooner. see the attached sheet.
dust 1.xlsx
View 2 Replies
View Related
Apr 7, 2013
Can you ctrl-F for only highlighted cells? I want to change all cells with '#VALUE!' in them, however, I only want to do this for a few columns.
View 4 Replies
View Related
Mar 5, 2014
I'm trying to format a new spreadsheet and was wondering if there was a way that I could stop the search function (normal Ctrl + F) looking through all cells, and only looking through column A? It has to be permanent, so I couldn't only highlight the ones I need when searching, and I can't use VBA due to security risks.Is this even possible?
View 7 Replies
View Related
Oct 12, 2008
Can you help with how to import into vba just the data in the currently selected cells?
What I want to do is to manually select a range of rows (in a single column) and upon running the macro put the data from each cell into the uppermost cell with each seperated with a comma.
I can manage the combining of the data but don't now the selection is read into VBA.
View 8 Replies
View Related
May 4, 2009
i try do function, which will be search/monitoring in selected cell (colored – yellow, orange, blue) and display (in green/results column) the last value in row colored/selected cell (first value from right side – results will be only for row).
View 14 Replies
View Related
Jan 11, 2012
I have a worksheet which will take a long time to recalculate. So, I want to recalculate only on selected range.
View 2 Replies
View Related
Jan 3, 2007
I want to transport the other column that they not changed rows that I have been selected somerows at the column.
For ex.
at Column A
Rows 2,4,7,9,22,34 .all select cells are going to transport column B.But select rows are not going to change.
View 9 Replies
View Related
Dec 8, 2006
I want to be able to select a range on my spreadsheet, click a button, and have everything that is not selected hide itself. I've tried using intersect, but I'm not sure how to (quickly) loop through all of the columns and rows to see if my range is contained within.
View 2 Replies
View Related
Aug 9, 2007
How can I count the number of selected cells on an active worksheet? The number of rows and columns that a selected cell can be on change dynamically.
View 2 Replies
View Related
Oct 19, 2007
for a small online database I have a column that lists nationalities:
French
Spanish
American
Latin American
(etc etc)
I need to add a prefix to all nationalities, for example:
Artist Nationality///French
Artist Nationality///Spanish
Artist Nationality///American
Artist Nationality///Latin American
(etc etc)
Is there a way I can select the 700 cells and do this in one shot? I can't add formulas because I will have to paste all this in text pad and then upload it.
View 5 Replies
View Related