Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Help with "WITH"

To Anyone,

I'm attempting to Left Justify the contents of a single cell AND underline
it's contents at the same time,
followed by Right Justifying the contents of ANOTHER cell AND underlining
it's contents.

Both cells are within the same RANGE but at different offset's from the base
of the RANGE .
I thought I could use the following code - but it doesn't appear to be
working properly ...
Everything is LEFT justifying ...

'--------------------------------------------
Sub Add_Underline_Staff_Number()
' Sheet (offset) begins at the cell 1 line below
' SHIFT_CPC_Number_Chart_BASE (Currently: cell F5) of Daily Sheet
Sheets("Daily Sheet").Select
Range("SHIFT_CPC_Number_Chart_BASE").Activate
Range("SHIFT_CPC_Number_Chart_BASE").Offset(Range( "BODIES_MIN_DAY"),
0).Select
' Left Justify Cell's contents
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
' Underline Cell's contents
With .Font
.underline = xlUnderlineStyleSingle
End With
End With
Range("SHIFT_CPC_Number_Chart_BASE").Activate
Range("SHIFT_CPC_Number_Chart_BASE").Offset(Range( "BODIES_MIN_EVE"),
0).Select ' EVES Number
' Right Justify Cell's contents
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlCenter
' Underline Cell's contents
With .Font
.underline = xlUnderlineStyleSingle
End With
End With
Range("A3").Select
End Sub

'--------------------------------------------

Any help would be greatly appreciated,

Jim Pellechi


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with "WITH"

Suspect the values contained in Range("BODIES_MIN_DAY") and
Range("BODIES_MIN_EVE), used as arguments to the offset command do not
contain the numbers you intend.

Also, Note that offset from a range refers to a range of the same size.

Range("A1:C1").Offset(2,0) refers to A3:C3 as an example.

Since no one has any ideas what your named ranges refer to or to know what
you are trying to refer to, it is difficult to say what the exact problem
might be.

--
Regards,
Tom Ogivly

Pellechi wrote in message
...
To Anyone,

I'm attempting to Left Justify the contents of a single cell AND underline
it's contents at the same time,
followed by Right Justifying the contents of ANOTHER cell AND underlining
it's contents.

Both cells are within the same RANGE but at different offset's from the

base
of the RANGE .
I thought I could use the following code - but it doesn't appear to be
working properly ...
Everything is LEFT justifying ...

'--------------------------------------------
Sub Add_Underline_Staff_Number()
' Sheet (offset) begins at the cell 1 line below
' SHIFT_CPC_Number_Chart_BASE (Currently: cell F5) of Daily Sheet
Sheets("Daily Sheet").Select
Range("SHIFT_CPC_Number_Chart_BASE").Activate
Range("SHIFT_CPC_Number_Chart_BASE").Offset(Range( "BODIES_MIN_DAY"),
0).Select
' Left Justify Cell's contents
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
' Underline Cell's contents
With .Font
.underline = xlUnderlineStyleSingle
End With
End With
Range("SHIFT_CPC_Number_Chart_BASE").Activate
Range("SHIFT_CPC_Number_Chart_BASE").Offset(Range( "BODIES_MIN_EVE"),
0).Select ' EVES Number
' Right Justify Cell's contents
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlCenter
' Underline Cell's contents
With .Font
.underline = xlUnderlineStyleSingle
End With
End With
Range("A3").Select
End Sub

'--------------------------------------------

Any help would be greatly appreciated,

Jim Pellechi




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Help with "WITH"

Tom,

Found the problem on the line:
Range("SHIFT_CPC_Number_Chart_BASE").Activate

I changed FROM .Activate TO .Select
and the code works as expected ...

I thought .Activate was proper but apparently not ...

JimP


"Tom Ogilvy" wrote in message
...
Suspect the values contained in Range("BODIES_MIN_DAY") and
Range("BODIES_MIN_EVE), used as arguments to the offset command do not
contain the numbers you intend.

Also, Note that offset from a range refers to a range of the same size.

Range("A1:C1").Offset(2,0) refers to A3:C3 as an example.

Since no one has any ideas what your named ranges refer to or to know what
you are trying to refer to, it is difficult to say what the exact problem
might be.

--
Regards,
Tom Ogivly

Pellechi wrote in message
...
To Anyone,

I'm attempting to Left Justify the contents of a single cell AND

underline
it's contents at the same time,
followed by Right Justifying the contents of ANOTHER cell AND

underlining
it's contents.

Both cells are within the same RANGE but at different offset's from the

base
of the RANGE .
I thought I could use the following code - but it doesn't appear to be
working properly ...
Everything is LEFT justifying ...

'--------------------------------------------
Sub Add_Underline_Staff_Number()
' Sheet (offset) begins at the cell 1 line below
' SHIFT_CPC_Number_Chart_BASE (Currently: cell F5) of Daily Sheet
Sheets("Daily Sheet").Select
Range("SHIFT_CPC_Number_Chart_BASE").Activate
Range("SHIFT_CPC_Number_Chart_BASE").Offset(Range( "BODIES_MIN_DAY"),
0).Select
' Left Justify Cell's contents
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
' Underline Cell's contents
With .Font
.underline = xlUnderlineStyleSingle
End With
End With
Range("SHIFT_CPC_Number_Chart_BASE").Activate
Range("SHIFT_CPC_Number_Chart_BASE").Offset(Range( "BODIES_MIN_EVE"),
0).Select ' EVES Number
' Right Justify Cell's contents
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlCenter
' Underline Cell's contents
With .Font
.underline = xlUnderlineStyleSingle
End With
End With
Range("A3").Select
End Sub

'--------------------------------------------

Any help would be greatly appreciated,

Jim Pellechi






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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 07:04 AM.

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

About Us

"It's about Microsoft Excel"