My Assistant
|
|
Mar 26 2012, 01:26 PM
Post
#1
|
|
|
UtterAccess Ruler Posts: 4,237 From: Downey, CA |
This code runs all the way to the end of my worksheet, evaluating EVERY cell in column G - I want it to only go say 679 iterations, but I can't get the syntax right - currently, it runs through every row - all 1,048,000+
CODE Dim lstrow As Variant
ActiveCell.SpecialCells(xlLastCell).Select lstrow = ActiveCell.Row Range("G2").Select Do Until ActiveCell.Row = lstrow + 1 If IsEmpty(ActiveCell) = True Or IsDate(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select Else If IsEmpty(Range("ListsNotes!g9")) = True Or IsDate(Range("ListsNotes!g9")) = False Then MsgBox "There is no date to compare" Exit Sub Else If ActiveCell < DateValue(Range("ListsNotes!g9")) Then ActiveCell.Offset(0, -1).Select ActiveCell.FormulaR1C1 = "D" ActiveCell.Offset(1, 1).Select Else ActiveCell.Offset(0, -1).Select ActiveCell.FormulaR1C1 = "A" ActiveCell.Offset(1, 1).Select End If End If End If Loop 'Go to top Range("A1").Select End Sub |
|
|
|
bakersburg9 Loop Certain Number Of Times Mar 26 2012, 01:26 PM
Bob G that sounds peculiar. save and close the workbook.... Mar 26 2012, 01:30 PM
bakersburg9 QUOTE (Bob G @ Mar 26 2012, 06:30 PM) tha... Mar 26 2012, 01:36 PM
Bob G then you have something physically in that cell Mar 26 2012, 01:38 PM
bakersburg9 QUOTE (Bob G @ Mar 26 2012, 06:38 PM) the... Mar 26 2012, 01:47 PM
Bob G highlight all of the data you actually have and co... Mar 26 2012, 01:52 PM
ipisors Steve:
CODEtakes me to X1048576
1048576 being the... Mar 26 2012, 01:53 PM
Bob G isaac
not sure what you mean. forgetting any vba ... Mar 26 2012, 01:56 PM
ipisors I don't think all users have the exact same ex... Mar 26 2012, 02:01 PM
Bob G remember, i am not talking about using it in VBA f... Mar 26 2012, 02:07 PM
ipisors I see what you mean, I just don't use top-down... Mar 26 2012, 02:09 PM
DanielPineault I avoid the method you use to determine the last r... Mar 26 2012, 02:11 PM
ipisors I agree - sometimes 'invisible content' ca... Mar 26 2012, 02:13 PM
Bob G Daniel,
outside of VBA, just using keystrokes, ha... Mar 26 2012, 02:13 PM
norie If you want to loop through a range why not use a ... Mar 26 2012, 02:14 PM
bakersburg9 QUOTE (norie @ Mar 26 2012, 07:14 PM) If ... Mar 26 2012, 03:04 PM
norie It's probably not really the loop that's c... Mar 26 2012, 03:10 PM
bakersburg9 QUOTE (norie @ Mar 26 2012, 08:10 PM) Wha... Mar 26 2012, 03:25 PM
DanielPineault No, I can't say that I have. Mar 26 2012, 03:42 PM
bakersburg9 QUOTE (ipisors @ Mar 26 2012, 07:13 PM) I... Mar 26 2012, 03:44 PM
ipisors Are you saying to implement this idea in all of yo... Mar 26 2012, 03:49 PM
bakersburg9 QUOTE (ipisors @ Mar 26 2012, 08:49 PM) c... Mar 26 2012, 04:02 PM
ipisors Ok, so what do you have so far? and you want to g... Mar 26 2012, 04:04 PM
ipisors Ok, so what do you have so far? and you want to g... Mar 26 2012, 04:04 PM
bakersburg9 QUOTE (ipisors @ Mar 26 2012, 09:04 PM) O... Mar 26 2012, 04:05 PM
ipisors Ok, let's try this first, using 99% of your or... Mar 26 2012, 04:19 PM
bakersburg9 Isaac,
that worked like butter - took like 3 secon... Mar 26 2012, 04:38 PM
ipisors Glad to help Mar 26 2012, 04:40 PM
norie You could do that with a series of If statements a... Mar 26 2012, 05:28 PM
bakersburg9 norie,
I know this was just a rough example, and I... Mar 26 2012, 06:06 PM
norie Since column G isn't always going to be fully ... Mar 26 2012, 06:27 PM
norie Oops, forgot to add a check for G9 on 'ListNot... Mar 26 2012, 06:33 PM
bakersburg9 still nothing
(See attached) Mar 26 2012, 06:54 PM
norie How exactly are you running the code?
I've ma... Mar 26 2012, 07:10 PM
Bob G here is what I dont understand.
When I provided t... Mar 27 2012, 06:33 AM
norie Bob
Which code, in this thread, do you mean by ... Mar 27 2012, 06:52 AM
Bob G Norie,
The first post. The original version is mi... Mar 27 2012, 07:32 AM
bakersburg9 bob - I honestly don't know - I'll just th... Mar 27 2012, 09:42 AM
norie Anybody try the code in the workbook I attached? Mar 28 2012, 06:05 AM
ipisors well as long as this conversation is still active,... Mar 28 2012, 09:36 AM
bakersburg9 QUOTE (norie @ Mar 28 2012, 11:05 AM) Any... Mar 28 2012, 09:57 AM
bakersburg9 Yes, it's working, but....
QUOTE using 99% of... Mar 28 2012, 10:02 AM
norie Steve
I can't recall that multiple criteria ... Mar 28 2012, 10:56 AM![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 22nd May 2013 - 12:22 AM |