Quote:
|
Originally Posted by ntl customer
I wad wondering if anybody could help me with my IT work as I have no bloody idea how to do this, and it is driving me mad!
Basically I have a system where I have a form inside a spreadsheet and when I click a button to which I have assigned a macro to and it is supposed to copy all the fields to a 'database' sheet. I do this by recording a macro and copying and pasting the cells individually into the rows of the database.
That does that fine but I can't seem to get it to go onto the next line when it has finished pasting all the fields in. If you press the button with the macro assigned to it it just overwrites the fields from the previous transfer.
How do you get it to go onto the next line? I need an 'idiot's guide' please, so don't use any jargon and take it step by step - I am no expert at Excel and I have work due at the end of this week - not good!
Thanks
|
Well, hit ALT+F11 to see your VBA (Visual Basic for Applications) window and look at the module you have recorded.
You will see that you recorded the cell locations you pasted into, this is where you need a small loop.
You need to add a line which will check the contents of a pre-defined cell before pasting info.
EG, In cell C4 is the number 1.
You run your macro, it looks in C4 and sees "1", so paste starts on line 1
Once paste has finished, increase C4 by one.
Next time round, your macro see's the "2" in C4 so you start your paste on line 2.
It isn't actualy as easy as I've made it sound here, but it does point you in the right direction