Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

LINE OR LINES INSERTION AND COPY

Status
Not open for further replies.

Harley78

Electrical
May 8, 2007
77
0
0
US
sorry to be asking so many questions. but have been perusing through to find something that can help, but can't find it or i don't know what I am looking at.

Anyway, my question is.

if I have typed a 1,2,3... and so on, in column A on sheet 2, rows 2, 9, 13( now each can be different each time e.g. 4,5,21,35)

Can a macro be created that will look at sheet 2 and copy (say) Cell D5 on sheet 2 (since Column A has been marked),then go to sheet 1 insert row(s) under a certain heading ( this is my main form )where it needs to be placed and place what was in D5( sheet 2) into cell (say) B4 on sheet 1 ( or what ever row it needs to be)?


 
Replies continue below

Recommended for you

Maybe this might help

Sheet 1
Column B
Row 1 5410-6020(0)M-4719-F
Row 2 5410-6020(2)H-5030-R
Row 3 5003-5410-6015
Row 4 7503-310p-6620

Sheet 2
Column A Column D
Row 4 1 123594
Row 9 2 556978
Row 21 1 24891006

Sheet 3

Column A Column D
Row 11 1 123594
Row 12 2 556978
Row 16 1 24891006

So From Sheet 3 Row 12 Column D put in Sheet 1 under Row 1
From Sheet 2 Row 9 Column D put in Sheet 1 under Row 1
From Sheet 2 Row 21 Column D put in Sheet 1 under Row 3
From Sheet 2 Row 4 Column D put in Sheet 1 under Row 2
and so on.
 
You can certainly make a macro to copy values, insert rows, and paste values. However, I see no correlation between the data in your "sheets" and where you are saying that you want to put it. How the heck is the macro supposed to know that "556978" goes "under Row 1"? Is this another instance in which you have some secret goal that you've not told us yet?
 
I know, i know, my explenations are terrible.. and very sorry..

At the bottom you see Sheet 3 Row 12 Column D, So what I am trying to explain ( terribly at that ) is that when I Click a "command button" (failed to mention that)that it looks through all worksheets.... notes a numerical number in column A in all worksheets... then goes across the rows to column D grabs that cell and copies it to worksheet 1 under column B, but needs to insert a row prior to pasting. And also need to be put under the proper heading.... Again sorry, if I could paste an exact picture, I think it would be of more help explaining what I am trying to do.
 
My question was how do you know the correct "heading"? I don't see how you can tell from column "A" which "heading" the data is supposed to go under.

See faq559-1100 and faq559-1177
 
So sorry to be a PITA....

Are you saying that it can only be done, if the headings were attached in each worksheet? Which means i would have to manually enter this each time... if this is true, then I suppose i need to check other options.. or just forget this whole idea of automation....

e.g.

Sheet 2
Column A Column D
Row 4 1 123594 5410-6020(0)M-4719-F
Row 9 2 556978 5410-6020(2)H-5030-R Row 21 1 24891006 7503-310p-6620



 
There seems to be a bit of a gap here! You may find it helpful to start with one or two Excel tutorials, as they will give you an overview of what is, and isn't, possible (and available) in Excel.

Start here
and come back with your more specific and focussed questions when you have a good grasp of the basics.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
Steam Engine enthusiasts
Steam Engine Prints
 
You need to explain what criteria this macro is supposed to use to determine what data to copy and where it's supposed to put it. You've given examples of the data, but not the criteria. Give more details and don't assume anything about the approach to a solution.

TTFN

FAQ731-376
 
Status
Not open for further replies.
Back
Top