Color specific number of cells in colum from different sheet

  • Thread starter Thread starter jimbob
  • Start date Start date
J

jimbob

Hello,
I was wondering if it is possiable to color an exact number of
cells in a colum on one worksheet by retrieving a value from a cell on
another worksheet. Any help would be greatly appreciated. TIA!
 
Hi

Try this with Conditional formatting.

Enter the number 10 on cell A1 Sheet2
Select cells A1:A20 on Sheet1
Go to Format>Conditional Formatting
Select "Formula is"
Enter:
=ROW()<=INDIRECT("Sheet2!$A$1")
Click Format and pick color then Ok.

Only the cells A1:A10 should have the chosen format applied.

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Hi Jimbob,

Here is a macro solution with the value in A1 of sheet 2. You can
ColorIndex to any number to suit your color fancy and not use i.

Sub TheColor()
Dim i As Integer
i = Sheets("Sheet2").Range("A1").Value
Range("A1:A" & i).Interior.ColorIndex = i
End Sub

HTH
Regards,
Howard
 
Back
Top