Formatting Cells In VBA Macro?
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
ADVERTISEMENT
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
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
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
Nov 17, 2011
Working in Excel 2007. I am using excel for a data log (basically) and want it to format all empty cells in a row yellow if there is data in column A
Basically, If i have a value in A2, I want any empty cell between B2-G2 to be filled in yellow (as an idicator to the inputter that the cell needs to be completed).
there is already conditional formatting on these cells, which i want to maintain for the non-empty cells. I also have "0" as a value, so I couldn't use the basic conditional formatting setting it =0, it highlighted cells with $0.00, which i do not want.
View 5 Replies
View Related
Jul 18, 2006
Is there a way to set up a conditional format for several cells so that the cells are filled in with red until the user enters text in those cells??
View 5 Replies
View Related
Jul 2, 2014
So i've been trying to do this invoice/inventory/client , I couldn't find a way to somehow register the whole invoice as it is, so i can later print/visualize it if i lost the copy or something.
It would be best if it just stayed stored in a variable and not always visible, and only appeared if i wanted to check/print it.
The whole invoice would be from A1 to F30
Excel 2010 btw
View 5 Replies
View Related
May 3, 2013
What I am looking to do is;
If cell A2 = "Closed"
then I want cells B2 and C2 to strike through its own text.
I.E.
A2= anything other than "Closed"
then B2 and C2 = Blah blah blah
but if
A2 = Closed
then B2 and C2 = Blah blah blah
View 5 Replies
View Related
Jan 4, 2010
i have just read the thread started by scabertrain regarding "if" conditonal formating, but mines slightly different and i cant make head nor tale of the fomula shown.
So... Monthly budgeting... using a projected outgoing (A1) and an actual outgoing (A2) i want the colour "A2" to change depending on whether i have spent over the budgeted amount, green being underspent, orange for on target and red for over spending....
Example:
I predicted (A1) that i was going to spend £50 on a night out, but my actual spending (A2) was £100, i would like A2 to turn to red.
View 3 Replies
View Related
Jan 17, 2013
I have attached the sample. I need the cells without the employee or without a boss to highlight a color and i also need the date of certification to highlight if it is more than one year old.
conditional formatting.xlsx
View 4 Replies
View Related
Jul 30, 2014
Creating a project tracking sheet that is as automted as possible so that people dont have to populate lots. I have managed to get it to create a new sheet and populate according to a filled out combobox. The user then populates a 'milestone' section. When a button is clicked these are transferred to a GANTT chart type sheet and pasted. Before they are pasted the macro checks if the project title exists, if it does not it first pastes the title LEFT INDENTED. Then follows by pasting the milestones CENTRED. If the title exists, it inserts the milestones under the project title by copying and pasting all milestones. Hence, if milestones are regularly added, it will begin to add duplicates of the same milestone. I need to remove these. I would usually be able to do this however there is often the same milestone in numerous projects which I CANNOT remove as it would loose data. I would like a code that says between the cell I was searching for (Rng) and the next cell which is also left indented to remove duplicates. Basically I can't use x1enddown because it needs to stop at the next cell which has the same formatting... i.e. only duplicates to be removed out of the cells which are centred. I would then like it to repear this action for the whole document and move the next left indented cell and do the same.
It feels like a kind of backward conditional formatting is what I am looking for
Here is my code as it stands
Dim FindString As String
Dim Rng As Range
FindString = Range("D2").Value
If Trim(FindString) <> "" Then
[Code]....
View 9 Replies
View Related
Sep 15, 2014
I know how to format a cell so that if I type 5 it will say: 5 SF And then in another cell if I type 15, it will say: 15 Units
Is there any way possible to format a cell so that if I type (its actually calculated via formulas) these two numbers in one cell that it will format them both?
EXAMPLE: One cell that has 5, 15 will read: 5 SF and 15 Units
View 6 Replies
View Related
Feb 11, 2014
I am trying to get different people to add dates onto a spreadsheet but need a way to differentiate whos dates are whos. Is there a way to color the cells according to which user put the dates in automatically?
View 1 Replies
View Related
Oct 13, 2008
Is there a way to date format a cell so that when I enter only the number date (ie today is October 13 so I'd enter 13) the cell formats to the current month with the date?
So for today I'd enter "13" and the cell would read 13-Oct. Additionally, when the month turns to November that same cell, without me making any changes to it, would change to 13-Nov. For future dates it would always show the current month with the date I entered manually.
View 3 Replies
View Related
Nov 8, 2008
I have a spreadsheet to calculate piping offsets, center to center.
The formula in B:1 is simple. Take the length in cell A:1 and multiply
it by the square root of 2.
I then increment the length by 1/8 of an inch through cell A:180 and those
results are place in B:2 thru B:180.
The results are display to the nearest 1/16 of an inch. But if the actual
dimension is eight and one half inch, it is displayed as 8 8/16. For aesthetic
reason i wish to display the reducible fractions reduced. So that 8 8/16
is displayed as 8 1/2 inch.
I understand that i may go to each cell and individually format it accordingly
as halves
as quarters
as eights
but was wondering if there is an easier method.
View 6 Replies
View Related
May 13, 2009
Is there any way to make one cell on a separate sheet appear EXACTLY the same, including formatting and values?
As in this for example:
Pieces of Paper (Blue)
I would like to keep the formatting for (Blue) , color and bold, but I have not figured out how to do this.
View 12 Replies
View Related
Jul 3, 2009
I want to add some colour conditional formatting to the cells in column C, dependent on their variance to the figure in column B. I've got the basic gist of applying the rule to the one single cell, but I'm not sure how to apply it to all the cells in the column. I have tried "dragging" it down, but it then just gives me the variance to the original row.
View 2 Replies
View Related
Mar 18, 2013
I have Excel 2003 & am trying to design a template for keeping track of my design products. I have several rows for links to previews, downloads etc. I use the template when placing merchandise in stores so I can copy/paste the info where needed. I want to copy links to a cell but have them be non-clickable. If I paste the link & then right click the cell & choose remove hyperlink I get non-clickable text, however I lose the original formatting for that cell.(left/center/wrap text).
View 2 Replies
View Related
May 2, 2013
How to create custom formatting for cells like (%.00##).
View 2 Replies
View Related
Nov 8, 2008
Hi All, I have Column I, which has a drop down menu in it, which if "WITH NOU" is selected - i would like it to change the colour of the text in column B, to a dark blue?
View 9 Replies
View Related
Jul 25, 2009
I am trying to adjust a simple formula that I am using:
=IF(D3<>"",1,"") **Note this is clunky, but ISBLANK doesn't seem to work due to D3 containing a formula**
to also change the fill color of A3 to "Red" if data exists in D3. Everywhere I look online for the formula reference tries to point me to Conditional Formatting, Which doesnt seem to apply to seperate cells so I can't use this.
View 3 Replies
View Related
Mar 31, 2013
Range(Cells(iVar, 1), Cells(iVar, 12)).Resize(2).FillDown
Range(Cells(iVar, 14), Cells(iVar, 38)).Resize(2).FillDown
Can it be...?
Range(Cells(iVar, 1), Cells(iVar, 12)).Resize(2).FillDown.Format
Range(Cells(iVar, 14), Cells(iVar, 38)).Resize(2).FillDown.Format
Is there any way to filldown only the formatting? I am trying to make it copy only the formatting from those cells in the last used line to the cells in the next line down.
More of the code reads thusly...
Code:
Private Sub CommandButton2_Click()
Dim ws As Worksheet
Dim rngNext As Range[code]....
View 2 Replies
View Related
Apr 15, 2013
i want to know is there any way to set up conditional format to the cells used in a formula which is in another cell.
View 8 Replies
View Related
Jun 18, 2013
I am copying from a cell that has 100 (number stored at text) and want to display in a number format (100%) I keep getting 1000%. I've checked the format to ensure it has 0 decimal places. I've tried formatting the cells as a percent. Still no luck.
View 5 Replies
View Related
Jul 16, 2014
I am having a problem with formatting a cell. I have several (into the hundreds) of items that are being inputed and I am looking for resolution with formatting. I have gotten pretty close but there are some kinks that I can't seem to work out.
The column that I am working on has numbers such as these (they aren't currently formatted)
14-12345
14-01234
14-00123
these numbers are organized by 2 digit year (XX) a hyphen (-) and then a five digit number (XXXXX) hence XX-XXXXX.
My number already have the hyphen in them and the auto format has taken some of the numbers from XXXXX to XXX if the number started with two zeros.
14-123
14-1234
Is there anyway to custom format the cell so that it will turn
This into this
14-123 14-00123
But leave this 14-12345 alone?
The closest I have gotten to an answer is this formula 00"-0"0000, but that messes up the larger numbers.
View 1 Replies
View Related
Apr 10, 2007
I want my VB6 app to conditionally color some cells. How can I turn a cell red if the value is below zero and green if zero or above?
I want to use a dynamic formatting rather than hard code the color since the values will be edited in the spreadsheet.
Can I do this as a range? e.g. A2:A500
View 9 Replies
View Related
May 21, 2008
I want to enter dates in a column. How do I ensure that the user cannot enter an invalid date or entry that not a date such as text? Any invalid entries should automatically be Null.
View 9 Replies
View Related
Mar 1, 2010
I have a workbook (column K) set with the following format conditions:-
Cond.1 - =(I3="declined")
Cond. 2 - =(G3>0)
Cond. 3 - =(K3
View 9 Replies
View Related
Aug 13, 2006
I have a spreadsheet which I need more than 3 conditions to the formatting - is there anyway of doing this in VBA!!! Its for a holiday chart that i'm doing - some of the items they can enter into one cell is: B (Bank Holiday) / 1 (1 days holiday) / TR ( Training day) / SL (Study Leave) / 0.5 (half day hols) and more.
View 2 Replies
View Related
Oct 2, 2008
I have a macro (see attached) that works fairly well, but the one thing I cannot figure out how to do it how to merge cells whenever there is a break in Project ID.
If you take a look at the spreadsheet, you will see that columns B and C for the 2nd Project ID is merged just how I want it to look. The number of rows in each Project ID is variable.
View 3 Replies
View Related