New to macros

5 pts.
Tags:
Excel macros
Macros
Microsoft Excel
Hi, I'm just learning how to use macros and the first thing I'm trying to do is create a macro that will pull a character from a cell and place it in a new cell- for example "right(c10,1)". My problem is I have a large list that I want to do this with but everytime I click on my macro button it returns to the original cell I created the macro in. For example, if I create the macro while I'm in cell d10 I can go to cell d20, use the macro and it works fine. But then I would like to continue to cell d21 and use the macro again- then d22, d23 etc. but the cursor returns to cell d10. What am I missing?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Not sure what the issue is without seeing your code, but the following is a very generic example of what you may need to do:

<pre>Dim i as integer
Dim c as string

For i = 1 to 100
c = right(cells(i, 3), 1)
cells(i, 4) = c
Next i</pre>

What this will do is look at a list of 100 cells, take the first character of each cell and place it in the adjacent cell to the right. Play with it — hopefully it will help you out!

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following