Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default help with cell reference...

Hi

seems to be a simple question, just not so familiar with excel vba.

I am looping through column b (the loop happens after another condition is
met, i will leave this out of my snippet) so my range is column b and a 5
rows. i would like to format cells in column d & e if a codition is met. how
do i refer to column d & e if my range only has column b. i am pasting a
snippet of the code.

thanks,

sam


Code:
Set MyCell = .Range(.Cells(intRowCounter + 1, 2),
..Cells(intRowCounter + 5, 2))
For Each rRange In MyCell
If Trim(rRange) = "" Then
' this finds the total and colors it pink
' this is where i need some help
'rRange(.Cells(1, 4), .Cells(1,
5)).Interior.ColorIndex = 7
'rRange(.Cells(1, 4), .Cells(1, 5)).BorderAround
Weight:=xlMedium
Exit For
End If
Next rRange
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default help with cell reference...

Hi

I figured it out. i am just trying to minimize the code. is it posible to
combine these two lines:

rRange.Offset(0, 2).Interior.ColorIndex = 7
rRange.Offset(0, 3).Interior.ColorIndex = 7

Thanks,

Sam

"SAm" wrote:

Hi

seems to be a simple question, just not so familiar with excel vba.

I am looping through column b (the loop happens after another condition is
met, i will leave this out of my snippet) so my range is column b and a 5
rows. i would like to format cells in column d & e if a codition is met. how
do i refer to column d & e if my range only has column b. i am pasting a
snippet of the code.

thanks,

sam


Code:
Set MyCell = .Range(.Cells(intRowCounter + 1, 2),
.Cells(intRowCounter + 5, 2))
For Each rRange In MyCell
If Trim(rRange) = "" Then
' this finds the total and colors it pink
' this is where i need some help
'rRange(.Cells(1, 4), .Cells(1,
5)).Interior.ColorIndex = 7
'rRange(.Cells(1, 4), .Cells(1, 5)).BorderAround
Weight:=xlMedium
Exit For
End If
Next rRange

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default help with cell reference...

Sam,

Try it like this

rRange.Offset(0, 2).Resize(1, 2).Interior.ColorIndex = 7


--
Hope that helps.

Vergel Adriano


"SAm" wrote:

Hi

I figured it out. i am just trying to minimize the code. is it posible to
combine these two lines:

rRange.Offset(0, 2).Interior.ColorIndex = 7
rRange.Offset(0, 3).Interior.ColorIndex = 7

Thanks,

Sam

"SAm" wrote:

Hi

seems to be a simple question, just not so familiar with excel vba.

I am looping through column b (the loop happens after another condition is
met, i will leave this out of my snippet) so my range is column b and a 5
rows. i would like to format cells in column d & e if a codition is met. how
do i refer to column d & e if my range only has column b. i am pasting a
snippet of the code.

thanks,

sam


Code:
Set MyCell = .Range(.Cells(intRowCounter + 1, 2),
.Cells(intRowCounter + 5, 2))
For Each rRange In MyCell
If Trim(rRange) = "" Then
' this finds the total and colors it pink
' this is where i need some help
'rRange(.Cells(1, 4), .Cells(1,
5)).Interior.ColorIndex = 7
'rRange(.Cells(1, 4), .Cells(1, 5)).BorderAround
Weight:=xlMedium
Exit For
End If
Next rRange

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
Nesting a sheet name reference within a cell reference??? Broyston Excel Discussion (Misc queries) 9 July 8th 08 08:35 PM
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
absolute cell reference A spreadsheet cell reference that does no help Excel Discussion (Misc queries) 1 January 18th 06 06:56 PM
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. [email protected] Excel Worksheet Functions 2 December 11th 04 12:05 AM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


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