Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nat Nat is offline
external usenet poster
 
Posts: 47
Default Macro newbie - simple copy/paste function

Hi,

I have absolutely no knowledge of macro programming and am usually able to
find how to do things with the Office help but this time: not!

Here is what I would like to do:
I created an excel form (not using forms functions but simply locking
cells). I send this form to be filled-out and I would like to compile it
automatically in another xls.

I need a function that would copy cell C2 from "survey.xls" and paste (w/o
format) to the next empty line of row A in "results.xls" and so forth and so
on.

Can anyone point me in the right direction please? I am at a lost here.

Also, can someone suggest a simple book for a macro-newbie like me?

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Macro newbie - simple copy/paste function

Hopefully this should get you started:

Sub test()

Dim x As Long
Dim ValueC2 As Variant
'get value from cell C2
Windows("survey.xls").Activate
ValueC2 = Range("C2").Value
'activate workbook to put value into
Windows("results.xls").Activate
'find next empty row
With ActiveSheet
x = .Range("A65536").End(xlUp).Row
End With
'put value in
Range("A" & x).Value = ValueC2

End Sub

"Nat" wrote in message
...
Hi,

I have absolutely no knowledge of macro programming and am usually able to
find how to do things with the Office help but this time: not!

Here is what I would like to do:
I created an excel form (not using forms functions but simply locking
cells). I send this form to be filled-out and I would like to compile it
automatically in another xls.

I need a function that would copy cell C2 from "survey.xls" and paste (w/o
format) to the next empty line of row A in "results.xls" and so forth and
so
on.

Can anyone point me in the right direction please? I am at a lost here.

Also, can someone suggest a simple book for a macro-newbie like me?

Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro newbie - simple copy/paste function

Sub MacroTocopy()
Dim shResults as Worksheet, Dim shSurvey as Worksheet
Dim icol as Long, rw as Long, cell as Range
Dim rng as Range
set shResults = Workbooks("Results.xls").worksheets(1)
set shSurvey = workbooks("Survey.xls").Worksheets(1)
set rng = shSurvey.Range("C2,C7,C12,C20,D30,F40")
icol = 1
set rw = shResults.Cells(rows.count,1).End(xlup)(2).row
for each cell in rng
shResults.Cells(rw,icol).Value = cell.Value
icol = icol + 1
Next
End sub

However, it seems like you would want to process many different workbooks
with the macro and they all woudn't be named Survey.xls. If so, then change

shSurvey = Activesheet

and run the macro with the sheet to be processed as the activesheet.

--
Regards,
Tom Ogilvy


"Nat" wrote:

Hi,

I have absolutely no knowledge of macro programming and am usually able to
find how to do things with the Office help but this time: not!

Here is what I would like to do:
I created an excel form (not using forms functions but simply locking
cells). I send this form to be filled-out and I would like to compile it
automatically in another xls.

I need a function that would copy cell C2 from "survey.xls" and paste (w/o
format) to the next empty line of row A in "results.xls" and so forth and so
on.

Can anyone point me in the right direction please? I am at a lost here.

Also, can someone suggest a simple book for a macro-newbie like me?

Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Macro - I think... Copy - Paste on Click Scott Campbell[_2_] Excel Discussion (Misc queries) 5 November 14th 12 12:52 AM
[newbie] Macro for "copy and paste" Jon Excel Discussion (Misc queries) 1 April 2nd 09 10:36 AM
How to write a simple copy-paste macro? R. H. Rosenberg New Users to Excel 4 November 25th 06 12:26 AM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
VBA Newbie - Simple Macro Yeimi Excel Programming 2 April 13th 04 04:20 PM


All times are GMT +1. The time now is 06:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"