Add A Textbox At The Current Position (selected Cell) With A Set Size, Fill Color, And Border Color
Nov 2, 2008
I'm trying to add a textbox at the current position (selected cell) with a set size, fill color, and border color. I found this: http://msdn.microsoft.com/en-us/libr...8(VS.80).aspx:
I have a simple spreadsheet. A column for a persons name and 31 columns, one for each day of the month. I want to apply conditional formatting, either fill color or border color, to the date column of the current date when the spreadsheet is opened.
One of the action's on a large group of the controls is the same but except for one number
here is an example
If TextBox107.ForeColor = 255 Then ActiveCell. Offset(0, 53).Font.ColorIndex = 3 If TextBox108.ForeColor = 255 Then ActiveCell.Offset(0, 54).Font.ColorIndex = 3 If TextBox109.ForeColor = 255 Then ActiveCell.Offset(0, 55).Font.ColorIndex = 3
This makes a cell that correlates to the textbox red if the text in the textbox is red.
Now, I loads of these textboxes that all need to run the same code with just the Offset value one digit higher than the last and I was hoping I could create a loop to avoid a huge block of code but I can't work out how to make a constant that will +1 with each loop.
Also, can I assume that a loop will start with the control with the lowest number i.e. Textbox1 and then work its way through the rest of them in order?
1. By entering a numerical value in Cell A1 for example typing 5. 2. Then, next five columns would be blocked with specific color. 3. if i am typing 10, then 10 columns would be blocked with specific color.
I would like to accomplish 2 things in my Excel 2010 spreadsheet by click a cell which already has a number and formatting in it.
1. How do I change the color of the cell, the color of the number in it, and the border around it. (Make it look like I just pressed a button by clicking it.)
2. At the same time have the text in different cell and the number in the selected cell appear in another different cell. (Text in a different cell = A , and the number in the selected cell = 23, the value in the resulting cell be "A 23") Everything I would like to happen at the same time by clicking the selected cell. I would also like this to be done several times by clicking different cells and not changing the previously selected cells.
part of my code looks like this. Instead of it being if c.interior.colorindex i want it to be if top border color = 4.
How do i syntax this?
For Each c In Worksheets("Sheet1").Range("B7:DE7").Cells If c.Interior.ColorIndex = 4 Then Range("DH7").Value = Range("DH7").Value + c.Value Also, is there a way to specify Range("DH") and make the row be the current row, not hard coded to 7
When I launch excel 2007, i have cells with a grey border. I'm not sure what the colorindex is of this border.
Through a macro, when I format cells, I use
Cells(x,y).BorderAround ColorIndex:=xlAutomatic
xlAutomatic points to BLACK by default. Could someone tell me how I could reference the actual default colorindex (the grey one which seems to border all other cells, while not being xlAutomatic)?
I am trying to develop an Excel spread- sheet by using some macros. In detail, in my first worksheet, I have something like -
Exp1 .... Exp2 .... Exp3 .... : : : Expn ....
This rows are coming from another worksheet and I have used a macro (developed by me) to populate these rows. Even the number of rows to be populated is not fixed. However, I would like to add one row with text - " Total Expense" after those rows. This row will have some background color - say Tan - and font color - say Green - and also a border around its own - in nature, the border will be thick, Double and with color Rose. I have tried the following code in macro but not working properly -
Sub Include_Fields_n_Format(loc As String) tot_exp_scell = loc & f_scell tot_exp_ecell = loc & (f_scell + 1) Range(tot_exp_scell, tot_exp_ecell). Merge Range(tot_exp_scell, tot_exp_ecell).WrapText = True
Range(tot_exp_scell, tot_exp_ecell).Interior.Color = RGB(150, 150, 150) With Range(tot_exp_scell, tot_exp_ecell).Font...................
Cells C7:F7 are currently shaded light green. Cells G7:L7 are shaded light blue. M7 is shaded dark blue. N7:Q7 are shaded light yellow and R7:T7 are shaded light gray.
When any cell in that range (C7:T7) is clicked (selected), I want the cell color to change to it's normal color; like light yellow to yellow, light blue to blue, dark blue to blue, light green to green and finally light gray to gray.
These cells represent headings for a database. When a heading is selected, the database will sort by that column and the header will change colors. I can do the sort code.
If another header is chosen, the previous selection will need to revert back to it's lighter color and the new selection will change as above... so only ONE cell will be changed from it's "normal state" color at a time. This will serve as an indicator as to which column is being used for the sort. To the user, it will have the appearance of switching on and off.
If any other cell on the sheet is selected, then this should not trigger an event change.
I have a spreadsheet containing many rows of data that I need people to review. After reviewing the data in the column, a reviewer must enter comments in the right-most column and then hit the Enter key to move to the next row down.
What I'd like to happen -- As a reviewer selects the cell where they need to enter data, I want the entire row to highlight. I can use conditional formatting to change the color of the row once data is entered, but I want to change the color of the row when a specific cell is selected. I've attached a sample spreadsheet.
I am trying to assign a border and fill to cells, of identical colors, using VBA. Simple enough, yes? I am using the same RGB value for both the fill and the border, but in Excel 2003, they are assigned two different colors: the fill is the correct shade, but the border is not, which makes absolutely no sense to me. I could understand if both colors were slightly off from the shade I'm getting in 2007, but to have one be correct and the other not? I can manually assign the border to be the proper color, but this doesn't help.
I am writing a program in excel spreadsheet and I was wondering how to fill an input cell with color automatically in excel 2007.
I mean that, say I am writing an addition program, I am giving an input numbers in B1 and B2 and i am writing formula in B3 (=B1+B2). I want excel to fill B1 and B2 with yellow/any color automatlically. Only the cells with number input should be highlighted.
How to "hard code" a cell's fill color? I want to assign a cell's fill color to yellow. While setting the fill color is easily done, my problem is that as soon as I paste data into that cell, it looses its fill color. Is there a way to tell the cell to never change the fill color?
I am setting up a schedule maker for a coworker, in which I have divided two columns into time in and time out for each day of the week. My coworker wants the cell to be highlighted red if the shift is a night shift (Begins after 4), and I used conditional formatting to set up both columns independently to evaluate if the value of their content is after 4 PM. However, this means if a shift starts at noon, but ends after 4, only the time out cell will be highlighted red, not a huge issue but it isn't aesthetically pleasing.
I wish to do the following & and am struggling (attempted to do it in Conditional Formatting but have not succeeded)
I want to do the following :-
If the date in cell A1 has no date entered i.e blank then fill D1 in Yellow If a date in cell B1 is past then fill Cell D1 Red If a date in cell C1 is entered with a date(any) then fill D1 in Green
I have 10 rows of 6 numbers, all between 1 & 49, in the range A1:F10. I also have the range A20:AW20, which are all currently blank cells. When I type a number between 1 and 49 inclusive into the range A20:AW20, any number that matches it in the range A1:F1 I want the cell to fill in colour.
If I use Conditional Formatting I can only use 3 colors, I'd like to use 8 or 9. Is there another way to do this without using the Conditional Formatting?
I need a macro to fill any cell in any column with red color. The same cell should also have red fonts with word 'RED' typed in the cell, so that word 'RED' is invisible.
I have a spreadsheet that has a bunch of empty cells that I need to fill in. Someone else needs to know which ones I have filled in after I am done. Is there a way that I can have Excel automatically highlight the cell after I put something in?
I know I could highlight the cell manually after I put something in it but if Excel can do this automatically for me, that would be the best as this is a very large spreadsheet and there will be many blanks to fill in. I am using Excel 2003.