Recorded Macro

D

Dean

This is a dumb question I know.

When I'm recording, I often gets things like the following below. Is it only the last line that matters? If not, what was the equivalent shorter way to write this? I'm embarrassed to let someone see 50 lines of code that could be done with one line!

Thanks!
Dean

ActiveWindow.ScrollColumn = 147
ActiveWindow.ScrollColumn = 143
ActiveWindow.ScrollColumn = 142
ActiveWindow.ScrollColumn = 136
ActiveWindow.ScrollColumn = 131
ActiveWindow.ScrollColumn = 126
ActiveWindow.ScrollColumn = 117
ActiveWindow.ScrollColumn = 112
ActiveWindow.ScrollColumn = 103
ActiveWindow.ScrollColumn = 93
ActiveWindow.ScrollColumn = 84
ActiveWindow.ScrollColumn = 75
ActiveWindow.ScrollColumn = 70
ActiveWindow.ScrollColumn = 61
ActiveWindow.ScrollColumn = 56
ActiveWindow.ScrollColumn = 50
ActiveWindow.ScrollColumn = 45
ActiveWindow.ScrollColumn = 43
ActiveWindow.ScrollColumn = 38
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 33
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 36
ActiveWindow.ScrollColumn = 40
ActiveWindow.ScrollColumn = 43
ActiveWindow.ScrollColumn = 49
ActiveWindow.ScrollColumn = 52
ActiveWindow.ScrollColumn = 57
ActiveWindow.ScrollColumn = 59
ActiveWindow.ScrollColumn = 63
ActiveWindow.ScrollColumn = 66
ActiveWindow.ScrollColumn = 68
ActiveWindow.ScrollColumn = 71
ActiveWindow.ScrollColumn = 73
ActiveWindow.ScrollColumn = 77
ActiveWindow.ScrollColumn = 78
ActiveWindow.ScrollColumn = 80
ActiveWindow.ScrollColumn = 82
ActiveWindow.ScrollColumn = 80
ActiveWindow.ScrollColumn = 78
ActiveWindow.ScrollColumn = 77
ActiveWindow.ScrollColumn = 75
ActiveWindow.ScrollColumn = 73
ActiveWindow.ScrollColumn = 71
ActiveWindow.ScrollColumn = 70
ActiveWindow.ScrollColumn = 68
ActiveWindow.ScrollColumn = 66
ActiveWindow.ScrollColumn = 64
ActiveWindow.ScrollColumn = 63
ActiveWindow.ScrollColumn = 61
ActiveWindow.ScrollColumn = 59
ActiveWindow.ScrollColumn = 57
ActiveWindow.ScrollColumn = 56
ActiveWindow.ScrollColumn = 54
ActiveWindow.ScrollColumn = 50
ActiveWindow.ScrollColumn = 49
ActiveWindow.ScrollColumn = 47
ActiveWindow.ScrollColumn = 45
ActiveWindow.ScrollColumn = 43
ActiveWindow.ScrollColumn = 40
ActiveWindow.ScrollColumn = 38
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 3
 
S

sonu

what are you trying to do. the code that you have only scrolls columns.
Is there a reason why you want to scroll thru these columns like this.
 
S

sonu

what are you trying to do. the code that you have only scrolls columns.
Is there a reason why you want to scroll thru these columns like this.
 
D

Dean

I don't know what I was doing - perhaps looking for the right column to stop
at. It was some time ago.

Is it clear that all this accomplishes nothing and that the last line is all
that I need, assuming that it represents my ending location?

Thanks!
Dean
 
J

julian

That's the problem with recording a macro. Just delete these redundant
lines of code after recording. I believe your macro will still work.

regards,
julian
 
D

Dean

I ASSUME YOU MEAN THAT I SHOULD KEEP THE LAST ONE, i.e., that the last one
accomplishes the same thing as all of them - is that right?

Thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top