For iValue = 2 to 10
Range(“B”&cstr(iValue)).value= range(“A”&cstr(iValue)).value+1
Next iValue

In this example, we want to take 1+ the value of whatever is in column A for the first 10 rows and put the new value in column B.

This could be done with a simple formula in column B, but it wouldn’t help show how to work with data.

This will use a for loop. For loops run the same script from one number to the next specified. In this case from row 2 to row 10.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s