LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Working With A Loop

I posted something about this last Friday, but I have rewritten it and
found out specifically where my problem is at. For some reason, I am
having trouble updating the offset function in my selection.find
method. It works just fine until I perform this action.

To give you a clearer picture of what this code is supposed to be
doing:

It is part of a much larger macro that is writing out a dashboard for
me from a series of tables I have in other spreadsheets. This code is
identifying specific values in my table(located in the _2008_Tickets
spreadsheet) and putting them into a table in a different spreadsheet,
according to a month(which the user enters at the beginning of the
macro). The months are listed across the top of my table(i.e. For M =
1 to 12) and the indicators are listed along the left hand side
vertically(i.e. Do Until T = 10).

This line: CURRPERCENTAGE.Offset(X, 0) = ActiveCell is how my code
moves from row to row and consequently moves through the table.

This line: Set CURRPERCENTAGE = CURRPERCENTAGE.Offset(0, 1) is how I
move from column to column through my table.

This line: selection.find().offset(0,DD).activate is incremented by 2
because I want to pull every other value in that row out of the
table. The in between values are placed in a separate table. To
clarify: my table is located in columns WZU:XAN. In WZU, my code is
finding the month, then offsetting by 1 column 0 rows, pulling out the
value, then finding the next month, offsetting by the same amount,
extracting the value, until it gets to 12. The next step is to do the
same thing again, except offset by 3 columns 0 rows. It should do
this 10 times.

The error I get is object or with block variable not set. I only get
the error when I put in the DD variable. The problem is this is very
crucial to my loop. I need this variable or else I will have the same
variable 10 times for each month.

Thanks for your help guys. Hopefully I can figure this one out in
short order. I needed to solve it last week..:(

Set CURRPERCENTAGE = range("D174")

Sheets("_2008_Tickets").Select


X = 1
T = 1
DD = 1

Do Until T = 10
For M = 1 To 12
range("SP[DATE]").Select
Selection.Find(What:=CURRPERCENTAGE, After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(0,
DD).Activate
CURRPERCENTAGE.Offset(X, 0) = ActiveCell
MsgBox CURRPERCENTAGE.Offset(X, 0).Address
Set CURRPERCENTAGE = CURRPERCENTAGE.Offset(0, 1)
Next
Set CURRPERCENTAGE = CURRPERCENTAGE.Offset(0, -11)
T = T + 1
X = X + 1
DD = DD + 2
Loop
 
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
For...Each loop not working Jayne22 Excel Programming 5 August 13th 08 03:22 PM
Loop Not Working Paul Black Excel Programming 7 August 29th 07 08:33 PM
Why is this loop not working? Mike R. Excel Programming 12 July 25th 07 02:26 PM
Loop not working!! Simon Excel Programming 2 August 2nd 05 04:16 PM
for next loop not working Ron Rosenfeld Excel Programming 0 September 25th 04 04:07 AM


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