interpreting macro

ESath

New Member
Joined
Apr 19, 2010
Messages
12
I have a code that I tried that doesn't seem to be working in excel. Can anyone tell me what it does and how to use it? Thanks.

Sub macro1()
For i = 2 To 100 Step 4
Range("A" & i) = ZipConvert(Range("A" & i))
Next i
End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I've commented the code for you, hopefully it makes sense.

Code:
Sub macro1() ' macro name, performs no action
 
For i = 2 To 100 Step 4 ' starts with i as value of 2
 
Range("A" & i) = ZipConvert(Range("A" & i)) ' copies value of ZipConvert!A2 to A2 on the visible sheet
 
Next i ' repeats the above process, adding the step value to i, so A2 will become A6, then A10, etc. will stop when i goes above the limit value of 100
 
End Sub ' confirms end of macro

To use it you need to go to the macro's section in the view menu, select macro1, then run.
 
Upvote 0
I'd have to respectfully disagree with jasonb on the zipconvert line. My guess is that zipconvert is a Function (additional vba code) that converts a number like a zip code into some other format or something like that.
 
Upvote 0
Good catch Alpha, don't know what made me see that as a worksheet name, probably doing to many worksheet formulae recently and forgotten what VBA syntax should look like, either that or it's just my brain telling me that on a saturday evening VBA should stand for Vodka Beer & Absinthe :beerchug:
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top