Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Simple line fix request.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sungen99 - 25 Jan 2006 14:48 GMT
As I am only a hack when it comes to programming I need a little hel
with something that I’m sure is really easy.

I kinda have a program that records data for a day and then at the en
of the day adds it to the end of another spreadsheet that keep all th
records.

I wanted to merger the file so it is all in one spreadsheet.  The cod
below is what the data file is but I don’t know how to change the lik
to make it just reflect the “trade history” worksheet now instead o
this other file.

Sorry for being so stupid.

Set destWB = Workbooks.Open("C:\Documents and Settings\Da
Smith\Taris\Admin\Execution\Taris 2005 Data-Ver1 1.xls"
Tom Ogilvy - 25 Jan 2006 14:57 GMT
Assume DestWb is dimmed as Workbook.  If so, you can't just redim it to be a
worksheet and point it at a worksheet without adjusting all code that used
it to expect a worksheet.

Dim DestWb as Worksheet
set DestWb = Worksheets("Trade History")

  but you would need to make other adjustments

Signature

Regards,
Tom Ogilvy

> As I am only a hack when it comes to programming I need a little help
> with something that I'm sure is really easy.
[quoted text clipped - 12 lines]
> Set destWB = Workbooks.Open("C:\Documents and Settings\Dan
> Smith\Taris\Admin\Execution\Taris 2005 Data-Ver1 1.xls")
sungen99 - 25 Jan 2006 15:35 GMT
This is my code that does this.  does this help you more?

Sub copy_to_another_workbook()

Dim sourceRange As Range
Dim destrange As Range
Dim destWB As Workbook
Dim Lr As Long

Application.ScreenUpdating = False

Set destWB = Workbooks.Open("C:\Data-Ver1 1.xls")

Lr = LastRow(destWB.Worksheets("At A Glance")) + 1
Set sourceRange =
ThisWorkbook.Worksheets("Today").Range("A2:N500")
Set destrange = destWB.Worksheets("At A Glance").Range("A" & Lr)
sourceRange.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
destWB.Close True

Signature

sungen99

Tom Ogilvy - 25 Jan 2006 15:45 GMT
Dim destWS as Worksheet
Set destWS = ThisWorkbook.Worksheets("Trade History")

Lr = LastRow(destWS) + 1
Set sourceRange =
ThisWorkbook.Worksheets("Today").Range("A2:N500")
Set destrange = destWS.Range("A" & Lr)
sourceRange.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False

Signature

Regards,
Tom Ogilvy

> This is my code that does this.  does this help you more?
>
[quoted text clipped - 17 lines]
> Application.CutCopyMode = False
> destWB.Close True
sungen99 - 25 Jan 2006 16:45 GMT
Never mind... i missed something.

thanks again!!!!

Signature

sungen99

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.