• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

creating first macro

MikeH

New Member
So Ive never created a macro before, and I have an idea that I would like to work on, but I just don't know where to begin as far as coding it. Here is an example of what I want to do...

a list of names in Column A, one in each cell. lets call it: cat, dog, fox

Click the button

Returns a separate output for each entry in a new sheet with all entries listed in column A of new sheet.

ie.
The first Cat jumped, while the second Cat slept.
The first Dog jumped, while the second Dog slept.
The first Fox jumped, while the second Fox slept.



(I would then be copying and pasting the complete output into another application)

I hope I have explained what I am trying to do. Any help would be appreciated!
 
Hi Mike,

A few clarifications:
"with all entries" refers to different cell values?
Are we searching every sheet in the workbook, or just the single sheet?

It would help if you could provide an example workbook. Coding often has to be a bit specific, so having the layout you are starting with would save a lot of time.
 
It will be a completely empty workbook with the exception of whatever I input into column A ---and the macro button. Once i get my output, the workbook will be cleared for the next round of entries.

So, yes. It will only be searching Column A of that particular sheet.
 
Ok, that's good, only have a simple range...I'm still confused as to what the difference is between starting appearance and output appearance. Can you provide a larger example, showing the before/after?
 
Starts with one word input (per cell) as a variable. The output will be a predetermined paragraph with the variable inserted into various places throughout the paragraph. What I am doing now is pasting the paragraph, then doing a search and replace for each entry...and its long, and tedious. I want to make this procedure easier and able to do this in bulk.
 
How's this? Use statis range definitions (they are hard coded), but you could make them dynamic, or use named ranges if you want some flexibility.
 

Attachments

  • MacroExample.xlsm
    16.3 KB · Views: 1
Awesome! Made a couple changes to make it suit my need and it works like a charm! Thank you so much! Saved me hours of work!
 
Hey Luke, I'm noticing that every returned output is surrounded with quotes, anything I can do to the code to prevent that?
 
Hey Luke, I'm noticing that every returned output is surrounded with quotes, anything I can do to the code to prevent that?
Can you elaborate on what you mean? In the file I posted, when I run the macro, i'm not seeing any quotation marks.
upload_2015-4-14_8-25-43.png
 
Its actually happening after I copy and paste the cell, (they are multi line). So I guess it actually has nothing to do with the Macro...or excel for that matter. Sorry bout that.
 
Back
Top