Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Macro for Selecting Cells within a Range

I am a novice macro writer and need help with the following. Here is a piece
of a macro I recorded:

Range("P:P,N:N,L:L,J:J,G:G").Select
Selection.NumberFormat = "#,##0.0_);(#,##0.0)"

The end result I am shooting for is to change the number format as described
above but only for certain cells within the columns I have named in the first
line. Can I modify that line to include the names of these cells or is it
more complicated than this? Help!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Macro for Selecting Cells within a Range

Todd,

For example, to only change rows 3 to 10 within your range:

Intersect(Range("3:10"), Range("P:P,N:N,L:L,J:J,G:G")).NumberFormat = "#,##0.0_);(#,##0.0)"

--
HTH,
Bernie
MS Excel MVP


"ToddS" wrote in message
...
I am a novice macro writer and need help with the following. Here is a piece
of a macro I recorded:

Range("P:P,N:N,L:L,J:J,G:G").Select
Selection.NumberFormat = "#,##0.0_);(#,##0.0)"

The end result I am shooting for is to change the number format as described
above but only for certain cells within the columns I have named in the first
line. Can I modify that line to include the names of these cells or is it
more complicated than this? Help!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Macro for Selecting Cells within a Range

I guess I should've clarified. I have a list of bases in column B. there
are certain bases that must be included (effectively EXCLUDING the remainder)
in this range of other columns to which I am applying the formatting (the
columns in the line below - P, N, L, J and G) and I wasn't sure how to refer
to them in the macro.

"Bernie Deitrick" wrote:

Todd,

For example, to only change rows 3 to 10 within your range:

Intersect(Range("3:10"), Range("P:P,N:N,L:L,J:J,G:G")).NumberFormat = "#,##0.0_);(#,##0.0)"

--
HTH,
Bernie
MS Excel MVP


"ToddS" wrote in message
...
I am a novice macro writer and need help with the following. Here is a piece
of a macro I recorded:

Range("P:P,N:N,L:L,J:J,G:G").Select
Selection.NumberFormat = "#,##0.0_);(#,##0.0)"

The end result I am shooting for is to change the number format as described
above but only for certain cells within the columns I have named in the first
line. Can I modify that line to include the names of these cells or is it
more complicated than this? Help!




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 a range of cells in a macro Victor Delta[_2_] Excel Discussion (Misc queries) 5 July 26th 08 12:19 AM
macro syntax for selecting variable range Matt Excel Discussion (Misc queries) 1 October 31st 07 07:13 PM
Selecting a range of cells, how to ? Luc Excel Worksheet Functions 2 February 23rd 07 07:17 PM
Selecting a range of values on pivot table attribute with a macro Ryan Hartnett Excel Discussion (Misc queries) 1 October 24th 06 10:21 PM
Range selecting cells Alec H Excel Discussion (Misc queries) 2 March 14th 06 01:36 PM


All times are GMT +1. The time now is 10:44 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"