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
 

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
11,983
Office Version
  1. 365
Platform
  1. Windows
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.
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,384
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.
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
11,983
Office Version
  1. 365
Platform
  1. Windows
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 (y)
 

Watch MrExcel Video

Forum statistics

Threads
1,123,343
Messages
5,601,073
Members
414,426
Latest member
fraru

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
Top