#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Range help

HI, Im using the following code :

Dim myrange As Range

Set myrange = Range("D1")

For Each Cell In Range("D3:AJ19")

If Cell.Offset(0, -2) = myrange Then
For c = 0 To 7
Cell.Offset(0, c).Value = [E21]
Next c
End If
If c = 10 Then
End If
Next

I would like to continue running the same code through the entire range
of D1:AJ1. When I try to add it in to "myrange" I keep getting an
error.

Thanks


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Range help

Dim myrange As Range
Dim Cell as Range, Cell1 as Range
Dim c as Long
Set myrange = Range("D1:AJ1")

For Each Cell In Range("D3:AJ19")

for each cell1 in MyRange
If Cell.Offset(0, -2) = Cell1 Then
For c = 0 To 7
Cell.Offset(0, c).Value = [E21]
Next c
Exit For
End If
Next cell1
If c = 10 Then
End If
Next

Might be what you are asking.

--
Regards,
Tom Ogilvy


"hotherps " wrote in message
...
HI, Im using the following code :

Dim myrange As Range

Set myrange = Range("D1")

For Each Cell In Range("D3:AJ19")

If Cell.Offset(0, -2) = myrange Then
For c = 0 To 7
Cell.Offset(0, c).Value = [E21]
Next c
End If
If c = 10 Then
End If
Next

I would like to continue running the same code through the entire range
of D1:AJ1. When I try to add it in to "myrange" I keep getting an
error.

Thanks


---
Message posted from http://www.ExcelForum.com/



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
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
formula to sort a range so that it matches the exact rows of a column that is outside that range? steveo Excel Discussion (Misc queries) 1 June 18th 06 02:05 AM
how to? set my range= my UDF argument (range vs. value in range) [advanced?] Keith R[_3_] Excel Programming 2 August 11th 03 05:55 PM


All times are GMT +1. The time now is 06:11 AM.

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"