Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I copy big ranges of cells without drag or copy/paste? | Excel Discussion (Misc queries) | |||
Copy & paste cells | Excel Discussion (Misc queries) | |||
Copy and paste versus copy and insert copied cells | New Users to Excel | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
how can we copy cells comments text and paste to cells | Excel Discussion (Misc queries) |