Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Different ways of generating same range object gives differentresults

I am using the code at http://www.vbaexpress.com/kb/archive.php/k-743.html
to change the color of some text in an Excel 2003 spreadsheet.

Here is how I am generating the range object specifier:

ActiveCell.Offset(0, 1) = "TopLine" & vbLf & "BottomLine"
ActiveCell.Offset(0, 1).Font.Color = vbBlack

'Call xlCellTextMgmt(Range("K20"), "TopLine", , , , , 3)
Call xlCellTextMgmt(ActiveCell(0, 1), "TopLine", , , , , 3)

When I submit Range("K20") to xlCellTextMgmt, nothing happens. When I
submit ActiveCell(0, 1) instead, all is fine. I know that they refer
to the same cell because the first two lines populate that cell.

Thanks for any debugging suggestions....Been banging at it for a while.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Different ways of generating same range object gives different res

The only way I see there being a difference if there was merged cells. I
cell a1: and B1 were merged together accessing B1 would give an error while
Range("A1").offset(0,1) would give C1.

" wrote:

I am using the code at http://www.vbaexpress.com/kb/archive.php/k-743.html
to change the color of some text in an Excel 2003 spreadsheet.

Here is how I am generating the range object specifier:

ActiveCell.Offset(0, 1) = "TopLine" & vbLf & "BottomLine"
ActiveCell.Offset(0, 1).Font.Color = vbBlack

'Call xlCellTextMgmt(Range("K20"), "TopLine", , , , , 3)
Call xlCellTextMgmt(ActiveCell(0, 1), "TopLine", , , , , 3)

When I submit Range("K20") to xlCellTextMgmt, nothing happens. When I
submit ActiveCell(0, 1) instead, all is fine. I know that they refer
to the same cell because the first two lines populate that cell.

Thanks for any debugging suggestions....Been banging at it for a while.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Different ways of generating same range object gives differentres

Actually, I found the problem. I supplied indices (0,1) to ActiveCell
rather than ActiveCell.Offset. Amazing what a new day can do.

Thanks!

On Jun 2, 9:02*pm, Joel wrote:
The only way I see there being a difference if there was merged cells. *I
cell a1: and B1 were merged together accessing B1 would give an error while
Range("A1").offset(0,1) would give C1.

I am using the code athttp://www.vbaexpress.com/kb/archive.php/k-743.html
to change the color of some text in an Excel 2003 spreadsheet.


Here is how I am generating the range object specifier:


ActiveCell.Offset(0, 1) = "TopLine" & vbLf & "BottomLine"
ActiveCell.Offset(0, 1).Font.Color = vbBlack


'Call xlCellTextMgmt(Range("K20"), "TopLine", , , , , 3)
Call xlCellTextMgmt(ActiveCell(0, 1), "TopLine", , , , , 3)


When I submit Range("K20") to xlCellTextMgmt, nothing happens. *When I
submit ActiveCell(0, 1) instead, all is fine. *I know that they refer
to the same cell because the first two lines populate that cell.


Thanks for any debugging suggestions....Been banging at it for a while.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Different ways of generating same range object gives differentres

Actually, I found the problem. I supplied indices (0,1) to ActiveCell
rather than ActiveCell.Offset. Amazing what a new day can do.

Thanks!

On Jun 2, 9:02*pm, Joel wrote:
The only way I see there being a difference if there was merged cells. *I
cell a1: and B1 were merged together accessing B1 would give an error while
Range("A1").offset(0,1) would give C1.

I am using the code athttp://www.vbaexpress.com/kb/archive.php/k-743.html
to change the color of some text in an Excel 2003 spreadsheet.


Here is how I am generating the range object specifier:


ActiveCell.Offset(0, 1) = "TopLine" & vbLf & "BottomLine"
ActiveCell.Offset(0, 1).Font.Color = vbBlack


'Call xlCellTextMgmt(Range("K20"), "TopLine", , , , , 3)
Call xlCellTextMgmt(ActiveCell(0, 1), "TopLine", , , , , 3)


When I submit Range("K20") to xlCellTextMgmt, nothing happens. *When I
submit ActiveCell(0, 1) instead, all is fine. *I know that they refer
to the same cell because the first two lines populate that cell.


Thanks for any debugging suggestions....Been banging at it for a while.

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
RANDBETWEEN generating numbers outside range Penny Black Excel Worksheet Functions 5 May 25th 10 10:14 PM
Automatically generating a number range Alyssa C. Excel Worksheet Functions 2 September 5th 06 11:24 PM
different ways to copy a range? botha822[_3_] Excel Programming 4 August 8th 06 12:06 AM
Alternative Ways to Spellcheck a Range Jay[_21_] Excel Programming 4 May 17th 06 09:43 PM
Example: Generating a Range String from numbers. Mac Lingo[_2_] Excel Programming 3 August 9th 04 01:54 PM


All times are GMT +1. The time now is 03:39 PM.

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"