ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple line fix request. (https://www.excelbanter.com/excel-programming/351442-simple-line-fix-request.html)

sungen99[_37_]

Simple line fix request.
 

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"

--
sungen9
-----------------------------------------------------------------------
sungen99's Profile: http://www.excelforum.com/member.php...nfo&userid=914
View this thread: http://www.excelforum.com/showthread.php?threadid=50491


Tom Ogilvy

Simple line fix request.
 
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

--
Regards,
Tom Ogilvy





"sungen99" wrote in
message ...

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.

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

I wanted to merger the file so it is all in one spreadsheet. The code
below is what the data file is but I don't know how to change the like
to make it just reflect the "trade history" worksheet now instead of
this other file.

Sorry for being so stupid.


Set destWB = Workbooks.Open("C:\Documents and Settings\Dan
Smith\Taris\Admin\Execution\Taris 2005 Data-Ver1 1.xls")


--
sungen99
------------------------------------------------------------------------
sungen99's Profile:

http://www.excelforum.com/member.php...fo&userid=9144
View this thread: http://www.excelforum.com/showthread...hreadid=504919




sungen99[_40_]

Simple line fix request.
 

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


--
sungen99
------------------------------------------------------------------------
sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144
View this thread: http://www.excelforum.com/showthread...hreadid=504919


Tom Ogilvy

Simple line fix request.
 
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


--
Regards,
Tom Ogilvy

"sungen99" wrote in
message ...

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


--
sungen99
------------------------------------------------------------------------
sungen99's Profile:

http://www.excelforum.com/member.php...fo&userid=9144
View this thread: http://www.excelforum.com/showthread...hreadid=504919




sungen99[_41_]

Simple line fix request.
 

Never mind... i missed something.


thanks again!!!!


--
sungen99
------------------------------------------------------------------------
sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144
View this thread: http://www.excelforum.com/showthread...hreadid=504919



All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com