Using conditional formatting in excel to high

Closed
Vishwas - Apr 30, 2011 at 03:51 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - May 2, 2011 at 01:57 AM
Hello,

I want to highlight the row based on cell value. For example. If I put 10 in one cell, it should highlight 10 rows like that. please advise which formula I need to use in conditional formatting
Related:

3 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Apr 30, 2011 at 10:19 PM
"put 10 in one cell, "

in which cell. what is the address of this cell


"should highlight 10 rows"

which ten rows.

give one or two actual examples
Hi,

Thanks for your reply.

Here is example for you.

If I put in A1 as 10, it should shade 10 rows in B column. i.e. B1 to B10. Next if i put in A11 as 2, it should shade only 2 rows in B column. i.e B11 to B12. How to do this using conditional formatting.

Thanks in advance

Regards,
Vishwas K V
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
May 2, 2011 at 01:57 AM
try this macro

Sub test()
Dim j As Integer, cadd As String, r As Range, r1 As Range

cadd = InputBox("type the cell where the numebr is entered. e.g. A1 or A11 etc")
Set r = Range(cadd)
j = r.Value
Set r1 = Range(r, r.Offset(j - 1, 0))
r1.EntireRow.Select

End Sub