Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Moving to newly Saved Workbook

I have a prob where I can't add data from a worksheet I'm working with and a
new workbook I just created.

original file in E:\
then
ActiveWorkbook.SaveAs Filename:="E:\Archived Logs\" & lz & " Data " & mydate
& ".xls"
Windows("original_file.xls").Activate
Sheets("Data").Select
Range("A3").Activate
hdr_bus = ActiveCell.Value
ActiveCell.Cells(1, 2).Activate
hdr_time = ActiveCell.Value
Windows(lz & "Data " & mydate).Activate
'At this point I expect code to put focus on the new workbook and
start adding data, BUT IT DOESN'T
Sheets("Sheet1").Activate
Range("A1").Activate
ActiveCell.FormulaR1C1 = hdr_bus
ActiveCell.Cells(1, 2).Activate
ActiveCell.FormulaR1C1 = hdr_time

The hdr_bus and hdr_time are written to the original_file.xls, Data
worksheet, range("A3")

I don't want to copy the entire worksheet because there are other areas that
cannot be copied to the new workbook.

Can you help please??

Don


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Moving to newly Saved Workbook

Try this approach......

Dim wbArchive As Workbook
Dim wbOriginal As Workbook

Set wbArchive = ActiveWorkbook
wbArchive.SaveAs Filename:="E:\Archived Logs\" & lz & " Data " & mydate &
".xls"

Windows("original_file.xls").Activate
Set wbOriginal = ActiveWorkbook

With wbOriginal.Sheets("Data")
wbArchive.Sheets("Sheet1").Range("A1") = .Range("A3").Value
wbArchive.Sheets("Sheet1").Range("A2") = .Range("A4").Value
End With

--

Regards,
Nigel




"DonW" wrote in message
...
I have a prob where I can't add data from a worksheet I'm working with and
a new workbook I just created.

original file in E:\
then
ActiveWorkbook.SaveAs Filename:="E:\Archived Logs\" & lz & " Data " &
mydate & ".xls"
Windows("original_file.xls").Activate
Sheets("Data").Select
Range("A3").Activate
hdr_bus = ActiveCell.Value
ActiveCell.Cells(1, 2).Activate
hdr_time = ActiveCell.Value
Windows(lz & "Data " & mydate).Activate
'At this point I expect code to put focus on the new workbook and
start adding data, BUT IT DOESN'T
Sheets("Sheet1").Activate
Range("A1").Activate
ActiveCell.FormulaR1C1 = hdr_bus
ActiveCell.Cells(1, 2).Activate
ActiveCell.FormulaR1C1 = hdr_time

The hdr_bus and hdr_time are written to the original_file.xls, Data
worksheet, range("A3")

I don't want to copy the entire worksheet because there are other areas
that cannot be copied to the new workbook.

Can you help please??

Don


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Moving to newly Saved Workbook

Thank you Nigel, I'll give it a try.....

Don

"Nigel" wrote in message
...
Try this approach......

Dim wbArchive As Workbook
Dim wbOriginal As Workbook

Set wbArchive = ActiveWorkbook
wbArchive.SaveAs Filename:="E:\Archived Logs\" & lz & " Data " & mydate &
".xls"

Windows("original_file.xls").Activate
Set wbOriginal = ActiveWorkbook

With wbOriginal.Sheets("Data")
wbArchive.Sheets("Sheet1").Range("A1") = .Range("A3").Value
wbArchive.Sheets("Sheet1").Range("A2") = .Range("A4").Value
End With

--

Regards,
Nigel




"DonW" wrote in message
...
I have a prob where I can't add data from a worksheet I'm working with and
a new workbook I just created.

original file in E:\
then
ActiveWorkbook.SaveAs Filename:="E:\Archived Logs\" & lz & " Data " &
mydate & ".xls"
Windows("original_file.xls").Activate
Sheets("Data").Select
Range("A3").Activate
hdr_bus = ActiveCell.Value
ActiveCell.Cells(1, 2).Activate
hdr_time = ActiveCell.Value
Windows(lz & "Data " & mydate).Activate
'At this point I expect code to put focus on the new workbook and
start adding data, BUT IT DOESN'T
Sheets("Sheet1").Activate
Range("A1").Activate
ActiveCell.FormulaR1C1 = hdr_bus
ActiveCell.Cells(1, 2).Activate
ActiveCell.FormulaR1C1 = hdr_time

The hdr_bus and hdr_time are written to the original_file.xls, Data
worksheet, range("A3")

I don't want to copy the entire worksheet because there are other areas
that cannot be copied to the new workbook.

Can you help please??

Don




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Moving to newly Saved Workbook

Now, Nigel, let's assume the data grows, how could I use your suggestion to
loop through, not only the header data - on row A3 in original file, but
also all of my data?

Don

"DonW" wrote in message
...
Thank you Nigel, I'll give it a try.....

Don

"Nigel" wrote in message
...
Try this approach......

Dim wbArchive As Workbook
Dim wbOriginal As Workbook

Set wbArchive = ActiveWorkbook
wbArchive.SaveAs Filename:="E:\Archived Logs\" & lz & " Data " & mydate &
".xls"

Windows("original_file.xls").Activate
Set wbOriginal = ActiveWorkbook

With wbOriginal.Sheets("Data")
wbArchive.Sheets("Sheet1").Range("A1") = .Range("A3").Value
wbArchive.Sheets("Sheet1").Range("A2") = .Range("A4").Value
End With

--

Regards,
Nigel




"DonW" wrote in message
...
I have a prob where I can't add data from a worksheet I'm working with
and a new workbook I just created.

original file in E:\
then
ActiveWorkbook.SaveAs Filename:="E:\Archived Logs\" & lz & " Data " &
mydate & ".xls"
Windows("original_file.xls").Activate
Sheets("Data").Select
Range("A3").Activate
hdr_bus = ActiveCell.Value
ActiveCell.Cells(1, 2).Activate
hdr_time = ActiveCell.Value
Windows(lz & "Data " & mydate).Activate
'At this point I expect code to put focus on the new workbook
and start adding data, BUT IT DOESN'T
Sheets("Sheet1").Activate
Range("A1").Activate
ActiveCell.FormulaR1C1 = hdr_bus
ActiveCell.Cells(1, 2).Activate
ActiveCell.FormulaR1C1 = hdr_time

The hdr_bus and hdr_time are written to the original_file.xls, Data
worksheet, range("A3")

I don't want to copy the entire worksheet because there are other areas
that cannot be copied to the new workbook.

Can you help please??

Don






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
Why is Referenced Workbook Saved When ActiveWorkbook is Saved? RyanH Excel Programming 1 October 29th 08 08:20 PM
How do I direct a macro to a newly opened workbook dave caizley Excel Programming 2 March 12th 08 05:19 PM
using a cell value to name a newly created workbook Guerilla Excel Discussion (Misc queries) 1 December 18th 06 01:45 AM
Save column J of WorkBook when WorkBook is not saved. mikeburg[_84_] Excel Programming 2 June 14th 06 09:57 PM
How can I see a copy of a saved workbook before I saved it again? Norma Excel Worksheet Functions 2 May 11th 05 10:31 AM


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