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

I'm trying to finish this up but I'm having a problem with the oute
loops.

For K = 305 To 316 '
For t = 319 To 330 '
For Each cell In Range("G11:n298") Step 8 '
c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
For i = 0 To 11
If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 An
_
Cells(cell.Row, c(i) + 97) = "x" Then
cell.Value = Cells(9, c(i) + 97)
End If
Next i
Next cell
Next K '
Next t '

What I'm trying to do is after the array completes I want to incremen
K by 1 and t by 1 and then step over to the next 8 columns("O11:V298"
and run the code again.

I have comments on the end of the lines that are not working.
Thank

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

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

foo = -1
For K = 305 To 316
t = K + 14
foo = foo + 8
For Each cell In Range(.Cells(11, foo), .Cells(298, foo + 7)) Step 8

blahblahblah

Next K

- piku

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

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

Thanks
I hate to ask but, I'm getting an error. The line with the "For Each
statment is colored red.

I think I pasted it correctly?

foo = -1
For K = 305 To 316
t = K + 14
foo = foo + 8
For Each cell In Range(.Cells(11, foo), (.Cells(298, foo + 7)) Step 8
c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
For i = 0 To 11
If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 An
_
Cells(cell.Row, c(i) + 97) = "x" Then
cell.Value = Cells(9, c(i) + 97)
End If
Next i
Next cell
Next

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

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

Hey,
I only looked at the lines that were broken before, but now that I'
looking a little more closely, I think you're going about this the lon
way. Please describe to me what it is you're doing in greater detail.
Thanks. - piku

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Range of columns

Try

For Each cell In Range(.Cells(11, foo), .Cells(298, foo + 7)) Step 8


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"hotherps " wrote in message
...
Thanks
I hate to ask but, I'm getting an error. The line with the "For Each"
statment is colored red.

I think I pasted it correctly?

foo = -1
For K = 305 To 316
t = K + 14
foo = foo + 8
For Each cell In Range(.Cells(11, foo), (.Cells(298, foo + 7)) Step 8
c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
For i = 0 To 11
If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 And
_
Cells(cell.Row, c(i) + 97) = "x" Then
cell.Value = Cells(9, c(i) + 97)
End If
Next i
Next cell
Next K


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





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

I'm sure I'm going about it wrong, it has been a real struggle. Thanks

It's kind of complicated, maybe you could view the attachment

Attachment filename: scheduledemo.zip
Download attachment: http://www.excelforum.com/attachment.php?postid=64420
--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Range of columns

c = Array(7, 8, 9, 10, 11, ...

You keep generating this same array with each loop. I would move this to
the very beginning so as to make it only once.

Actually, it appears you could drop the array, maybe something along this
line:

For c = 7 To 18
If Cells(t, c).Value - 1 = Cells(K, c) And ...etc


Just an idea.
Dana DeLouis


"hotherps " wrote in message
...
Thanks
I hate to ask but, I'm getting an error. The line with the "For Each"
statment is colored red.

I think I pasted it correctly?

foo = -1
For K = 305 To 316
t = K + 14
foo = foo + 8
For Each cell In Range(.Cells(11, foo), (.Cells(298, foo + 7)) Step 8
c = Array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
For i = 0 To 11
If Cells(t, c(i)).Value - 1 = Cells(K, c(i)) And cell.Value = 1 And
_
Cells(cell.Row, c(i) + 97) = "x" Then
cell.Value = Cells(9, c(i) + 97)
End If
Next i
Next cell
Next K


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



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

Thanks Bob but isn't your line exactly the same as what Pikus has?

I got the same error :Expected end of statment

???

Thanks Dana, I guess that could work, but I have some time constraint
at the moment. Maybe I can try it later

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

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

Hey again. It's funny to me that this is about scheduling. I am, by
trade, a workforce management analyst. I'll be taking this home with
me. I sent you my e-mail address in a private message, e-mail me and I
can send you the file as soon as it's complete. - pikus


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

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Range of columns

No I took out an extraneous ( which looked like the error to me.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"hotherps " wrote in message
...
Thanks Bob but isn't your line exactly the same as what Pikus has?

I got the same error :Expected end of statment

???

Thanks Dana, I guess that could work, but I have some time constraints
at the moment. Maybe I can try it later.


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





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

Yes i do see the difference now Bob, but the text still goes to a red
font and I get a syntax error message.

Thanks for the post


---
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
Linest - different columns for x range Lori Excel Worksheet Functions 0 May 23rd 07 04:16 PM
Sum a range of columns ? Ainsley Excel Discussion (Misc queries) 6 May 9th 06 10:43 AM
How do I get the MAX value of adjoining columns then SUM range? Dorothy Excel Worksheet Functions 1 April 4th 06 07:15 PM
Set range as multiple columns waveracerr[_17_] Excel Programming 1 February 23rd 04 06:10 PM
No of columns in range Ron McCormick[_2_] Excel Programming 1 October 8th 03 04:36 PM


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