Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting multiple cells, I can't see the cells highlighted ET Excel Discussion (Misc queries) 1 August 1st 08 03:20 PM
How to change shade of cells when selecting multiple cells abrummet Excel Discussion (Misc queries) 3 September 6th 07 11:42 AM
selecting cells without certain value OTS Excel Worksheet Functions 3 October 11th 06 07:02 PM
By selecting cells adjacent to cells tally sheet tom Excel Worksheet Functions 2 September 20th 06 07:09 PM
IRR - selecting cells Edc Excel Worksheet Functions 1 November 30th 05 01:36 PM


All times are GMT +1. The time now is 04:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"