Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting the right cells....
Hello. I try to select a range but the macro is hard coded into a specific range. I want it to be flexible depending on the number of rows. How do I do this? Here is the macro: Code: -------------------- Sub C612ToYellow() ' ' C612ToYellow Macro ' Macro recorded 2006-03-03 by ks32480 ' ' Keyboard Shortcut: Ctrl+Shift+E ' Range("A3").Select Range(Selection, Selection.End(xlDown)).Select Range("A3:O70").Select With Selection.Interior .ColorIndex = 36 .Pattern = xlSolid End With Range("A3").Select Selection.End(xlDown).Select End Sub -------------------- I want to remove the A3:O70 part. Instead I want the selection to select all rows were there are inputs from column A to O. How should I write this code? Thanks /Anders -- a94andwi ------------------------------------------------------------------------ a94andwi's Profile: http://www.excelforum.com/member.php...o&userid=21077 View this thread: http://www.excelforum.com/showthread...hreadid=519692 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting the right cells....
Hi A94andwi,
Try something like: '============= Public Sub Tester() Dim LRow As Long LRow = Cells(Rows.Count, "A").End(xlUp).Row With Range("A3:A" & LRow) .Interior.ColorIndex = 36 End With End Sub '<<============= --- Regards, Norman "a94andwi" wrote in message ... Hello. I try to select a range but the macro is hard coded into a specific range. I want it to be flexible depending on the number of rows. How do I do this? Here is the macro: Code: -------------------- Sub C612ToYellow() ' ' C612ToYellow Macro ' Macro recorded 2006-03-03 by ks32480 ' ' Keyboard Shortcut: Ctrl+Shift+E ' Range("A3").Select Range(Selection, Selection.End(xlDown)).Select Range("A3:O70").Select With Selection.Interior .ColorIndex = 36 .Pattern = xlSolid End With Range("A3").Select Selection.End(xlDown).Select End Sub -------------------- I want to remove the A3:O70 part. Instead I want the selection to select all rows were there are inputs from column A to O. How should I write this code? Thanks /Anders -- a94andwi ------------------------------------------------------------------------ a94andwi's Profile: http://www.excelforum.com/member.php...o&userid=21077 View this thread: http://www.excelforum.com/showthread...hreadid=519692 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting the right cells....
Thank you very much. It helped a lot. /Anders -- a94andwi ------------------------------------------------------------------------ a94andwi's Profile: http://www.excelforum.com/member.php...o&userid=21077 View this thread: http://www.excelforum.com/showthread...hreadid=519692 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting multiple cells, I can't see the cells highlighted | Excel Discussion (Misc queries) | |||
How to change shade of cells when selecting multiple cells | Excel Discussion (Misc queries) | |||
selecting cells without certain value | Excel Worksheet Functions | |||
By selecting cells adjacent to cells tally sheet | Excel Worksheet Functions | |||
IRR - selecting cells | Excel Worksheet Functions |