Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automate this code

I have the following code:
For Each cell In Range("G11:O125")
c = Array(11, 10, 9, 8, 7)
For i = 0 To 4
If Cells(356, c(i)).Value = Cells(305, c(i)) And cell.Value "" An
Cells(cell.Row, c(i) + 97) = "x" Then _
cell.Value = Cells(9, c(i) + 97)
Next i
Next

On the If statement I need to offset one cell down in both ranges abou
50 rows. i.e. 357,358 : 306,307 etc.

As opposed to doing this:

If Cells(356, c(i)).Value = Cells(305, c(i)) And cell.Value
If Cells(357, c(i)).Value = Cells(306, c(i)) And cell.Value
If Cells(358, c(i)).Value = Cells(307, c(i)) And cell.Value
Thank

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

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

do you want to do all three comparisons in the if statement or do you want
to do one of them for each pass through the loop, incrementing as you loop.
(if so, why only 3 ranges when the loop loops 5 times?)

--
Regards,
Tom Ogilvy

"hotherps " wrote in message
...
I have the following code:
For Each cell In Range("G11:O125")
c = Array(11, 10, 9, 8, 7)
For i = 0 To 4
If Cells(356, c(i)).Value = Cells(305, c(i)) And cell.Value "" And
Cells(cell.Row, c(i) + 97) = "x" Then _
cell.Value = Cells(9, c(i) + 97)
Next i
Next

On the If statement I need to offset one cell down in both ranges about
50 rows. i.e. 357,358 : 306,307 etc.

As opposed to doing this:

If Cells(356, c(i)).Value = Cells(305, c(i)) And cell.Value
If Cells(357, c(i)).Value = Cells(306, c(i)) And cell.Value
If Cells(358, c(i)).Value = Cells(307, c(i)) And cell.Value
Thanks


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automate this code

Thanks Tom, I replied to your post but I guess it did not take?

Yes it has to meet all three conditions before it loops. The range
listed id just a small part of the file. What I would like to do i
loop through 8 columns at a time from top D11 to Bottom CX125 , onl
advancing 8 colums to hthe right everytime the loop completes.

It's really not working that well.

Thanks for your help

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automate this code

Looks like you have an active thread going on this already.

--
Regards,
Tom Ogilvy

"hotherps " wrote in message
...
Thanks Tom, I replied to your post but I guess it did not take?

Yes it has to meet all three conditions before it loops. The range I
listed id just a small part of the file. What I would like to do is
loop through 8 columns at a time from top D11 to Bottom CX125 , only
advancing 8 colums to hthe right everytime the loop completes.

It's really not working that well.

Thanks for your help.


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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automate this code

Yes Tom I noticed, I think I started that by accident. Anyway Here i
what I have at the moment:

For Each cell In Range("G11:N125")
c = Array(15, 14, 13, 12, 11, 10, 9, 8, 7)
For i = 0 To 8
If Cells(356, c(i)).Value - 1 = Cells(305, c(i)) And cell.Value "
And Cells(cell.Row, c(i) + 97) = "x" Then _
cell.Value = Cells(9, c(i) + 97)
Next i
Next

The problem is that if the reference to Cells 356 and 305 is true th
code runs it's entire length. I need it to stop and check the cells on
row at a time down to
Cells 402 and 352
Thank

--
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
Using code to automate "h:mm" hol Excel Discussion (Misc queries) 6 November 30th 07 02:57 PM
use VB code IF to automate filling in 11 columns smart.daisy Excel Discussion (Misc queries) 1 May 29th 06 09:08 PM
Automate without add-ins Rob Oldfield Excel Discussion (Misc queries) 3 October 21st 05 07:33 PM
Automate PDF file creation in Excel code Ray[_11_] Excel Programming 5 May 17th 04 08:44 PM
VBA Code to automate "Save As" Kevin McLean Excel Programming 3 September 25th 03 11:56 PM


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