Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vb-Copy two cells, and paste into another worsksheet

I am having problems writing a macro that copy two cells on the sam
row, and pasting it on another spreadsheet. I want to be able to d
this until there is no more record on the spreadsheet.

Sub copy2cell()
'
' copy2cell Macro
' Macro recorded 4/1/2004 by Duc Tran
'

Range("A1, G1").Select
Selection.Copy
Sheets("Sheet1").Select
Range("A1").Select
ActiveSheet.Paste
activecell.offset(1,-2)

End Sub

this is what i have so far, i need to keep pasting all the records ont
Sheet1. Please help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vb-Copy two cells, and paste into another worsksheet

Why not just copy all of column A and paste it to the new sheet. The
do the same with column G. Unless I am misunderstanding...



--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vb-Copy two cells, and paste into another worsksheet

Sub copyesn()
Dim countall As Integer

countall = Range("h1").Value
Range("A1:A(countall)").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste

End Sub

in this case, cell h1 has a counta function within the spreadsheet t
tell me how many records are there. I did this to know how man
records for my range, but programming like this gives me an error. ho
do i go on about doing this

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vb-Copy two cells, and paste into another worsksheet

I'd change it to this:


Code
-------------------
Sub copyesn()
Dim countall As Integer

countall = Range("h65536").End(xlUp).Row
Range("A1:A" & countall).Select
Selection.Copy
Sheets("Sheet1").Select
Range("A1").Select
ActiveSheet.Paste

End Su
-------------------

The error was probably in the Range("A1:A(countall)").Select statemen
since you need to concatanate the string. Also, using a counta wil
only work if you have no empty spaces in your column. If you did, i
would not select the entire range. This is why I changed the coutal
definition.



--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vb-Copy two cells, and paste into another worsksheet

K,

Thanks for the great input. My problem was trying to put th
countall--a number--into a string. "A1:A & (countall)" "A1:A(countall)
.. i tried all of these but the correct one. Thanks K. you are th
best

--
Message posted from http://www.ExcelForum.com

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
How can I copy big ranges of cells without drag or copy/paste? Ricardo Julio Excel Discussion (Misc queries) 3 March 23rd 10 02:38 PM
Copy & paste cells Bobby[_3_] Excel Discussion (Misc queries) 4 January 17th 09 05:54 PM
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
how can we copy cells comments text and paste to cells שי פלד Excel Discussion (Misc queries) 3 December 12th 05 05:16 AM


All times are GMT +1. The time now is 10:08 PM.

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"