Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Code to copy cell values from one sheet to another

This will copy from Sheet1 cell D10 to Sheet2 first available cell in column B:

Sub CopyDemo()
Dim s1 As Worksheet, s2 As Worksheet
Dim rSource As Range, rDest As Range
Set s1 = Worksheets("Sheet1")
Set s2 = Worksheets("Sheet2")
Set rSource = s1.Range("D10")
n = s2.Cells(Rows.Count, 2).End(xlUp).Row + 1
Set rDest = s2.Range("B" & n)

rSource.Copy rDest

End Sub

--
Gary''s Student - gsnu200909


"Talat via OfficeKB.com" wrote:

Hi,

Can anybody help me with this?

I recorded a macro which copies cells value from one open excel file into
another excel file where it needs to find the lasy used row, and then copy
into cells in the row below it. But the resultant VBA code references actual
cell values eg Range("A15658").Select which does not work because next time
the macro is run it should be +1

steps might be
open worksheet a and Sheets
Copy from
sheetA, row 10, columnB
to worksheetB
last used row+1, column A

Copy from
sheetA, row 10, columnD
to worksheetB
last used row+1, column B ..... etc

Once I sort this out, I have one more query. If I can't sort it out myself,
would like to get back to you or the forum again.

Many thanks.

Talât

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200912/1

.

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
VAB to copy cell values into new Sheet, Overwrite if needed and based off of Cell Value in a column gumby Excel Programming 4 July 14th 07 01:55 AM
VBA code to copy cell contents from one sheet to another Gimp Excel Worksheet Functions 0 February 23rd 07 05:18 PM
code to FIND value, copy, paste values onto other sheet ufo_pilot Excel Programming 2 December 6th 05 04:14 PM
copy values generated by conditional formula in one sheet to the other work sheet as values ramana Excel Worksheet Functions 1 October 5th 05 01:04 PM
How do I automatically copy cell values from one sheet to another? stevebert1 Excel Programming 2 September 28th 05 03:51 PM


All times are GMT +1. The time now is 07:13 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"