Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default different workbooks

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value = sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default different workbooks

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet = Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value = sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default different workbooks

Hi Choice,

Try:

Sub InputData()
Dim WB1 As Workbook
Dim WB2 As Workbook
Dim SourceSheet As Worksheet
Dim DestSheet As Worksheet

Set WB1 = Workbooks("Data.xls")
Set WB2 = Workbooks("Register.xls")
Set SourceSheet = WB1.Sheets("Data")
Set DestSheet = WB2.Sheets("Register")

SourceSheet.Range("A1:A10").Copy
DestSheet.Range("A1").PasteSpecial xlPasteValues
Application.CutCopyMode = False

End Sub

--

---
Regards,
Norman



"choice" wrote in message
...
i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default different workbooks

cant seem to get it to work


"sebastienm" wrote:

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet = Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value = sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default different workbooks

Hi Choice,

Sebastien's code worked for me providing each instance of :

Worksheet

was reolaced with

Worksheets

---
Regards,
Norman



"choice" wrote in message
...
cant seem to get it to work


"sebastienm" wrote:

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet =
Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default different workbooks

Hi Choice,

I omitted to say that, in order successfully to use Sebastien's code, you
would need to correct your code line:

DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


to read:

DestSheet.Range("a1:a10").Value = _
SourceSheet.Range("a1:a10").Value

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Choice,

Sebastien's code worked for me providing each instance of :

Worksheet

was reolaced with

Worksheets

---
Regards,
Norman



"choice" wrote in message
...
cant seem to get it to work


"sebastienm" wrote:

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet =
Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default different workbooks

Hi Checker,

it worked OK with me without the alteration.:)


I am sorry to say that this assertion is even less accurate than your
chronmetrical skills.

However, given that the code works for you, perhaps *you* would care to
explain to Choice why it is that it he "cant seem to get it to work".


---
Regards,
Norman



"Cheker" wrote in message
...
it worked OK with me without the alteration.:)

"Norman Jones" wrote in message
...
Hi Choice,

I omitted to say that, in order successfully to use Sebastien's code,
you
would need to correct your code line:

DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


to read:

DestSheet.Range("a1:a10").Value = _
SourceSheet.Range("a1:a10").Value

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Choice,

Sebastien's code worked for me providing each instance of :

Worksheet

was reolaced with

Worksheets

---
Regards,
Norman



"choice" wrote in message
...
cant seem to get it to work


"sebastienm" wrote:

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet =
Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in

different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default different workbooks

Typo!

chronmetrical was intended to be chronometrical.


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Checker,

it worked OK with me without the alteration.:)


I am sorry to say that this assertion is even less accurate than your
chronmetrical skills.

However, given that the code works for you, perhaps *you* would care to
explain to Choice why it is that it he "cant seem to get it to work".


---
Regards,
Norman



"Cheker" wrote in message
...
it worked OK with me without the alteration.:)

"Norman Jones" wrote in message
...
Hi Choice,

I omitted to say that, in order successfully to use Sebastien's code,
you
would need to correct your code line:

DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value

to read:

DestSheet.Range("a1:a10").Value = _
SourceSheet.Range("a1:a10").Value

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Choice,

Sebastien's code worked for me providing each instance of :

Worksheet

was reolaced with

Worksheets

---
Regards,
Norman



"choice" wrote in message
...
cant seem to get it to work


"sebastienm" wrote:

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet =
Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in

different
workbooks...how would i add that in my code? i tried some stuff
but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance










  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default different workbooks

Set destSheet = Workbooks("data.xls").Worksheets("data")
Set sourceSheet = Workbooks("register.xls").Worksheets("register")
DestSheet.Range("a1:a10").Value = sourceSheet.Range("a1:a10").Value

--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"choice" wrote in message
...
i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default different workbooks

it worked OK with me without the alteration.:)

"Norman Jones" wrote in message
...
Hi Choice,

I omitted to say that, in order successfully to use Sebastien's code, you
would need to correct your code line:

DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


to read:

DestSheet.Range("a1:a10").Value = _
SourceSheet.Range("a1:a10").Value

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Choice,

Sebastien's code worked for me providing each instance of :

Worksheet

was reolaced with

Worksheets

---
Regards,
Norman



"choice" wrote in message
...
cant seem to get it to work


"sebastienm" wrote:

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet =
Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in

different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance









  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default different workbooks

Hi Norman,
I do not know why it didn't work for choice.
All I did was to try it as it was...It just worked fine.

"Norman Jones" wrote in message
...
Typo!

chronmetrical was intended to be chronometrical.


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Checker,

it worked OK with me without the alteration.:)


I am sorry to say that this assertion is even less accurate than your
chronmetrical skills.

However, given that the code works for you, perhaps *you* would care to
explain to Choice why it is that it he "cant seem to get it to work".


---
Regards,
Norman



"Cheker" wrote in message
...
it worked OK with me without the alteration.:)

"Norman Jones" wrote in message
...
Hi Choice,

I omitted to say that, in order successfully to use Sebastien's code,
you
would need to correct your code line:

DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value

to read:

DestSheet.Range("a1:a10").Value = _
SourceSheet.Range("a1:a10").Value

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Choice,

Sebastien's code worked for me providing each instance of :

Worksheet

was reolaced with

Worksheets

---
Regards,
Norman



"choice" wrote in message
...
cant seem to get it to work


"sebastienm" wrote:

Hi.
Are the 2 books open at that time? I assume they are.
Replace the two 'Set' lnes by:
Set destSheet = Workbooks("data.xls").Worksheet("data")
Set sourceSheet =
Workbooks("register.xls").Worksheet("register")

Regards,
Sebastien

"choice" wrote:

i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in
different
workbooks...how would i add that in my code? i tried some stuff
but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance












  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default different workbooks

WORKED...thank you

Next question has a couple parts.
so i have,
Set destSheet = Workbooks("data.xls").Worksheets("data")
Set sourceSheet = Workbooks("register.xls").Worksheets("register")
DestSheet.Range("a1:a10").Value = sourceSheet.Range("a1:a10").Value

but on destsheet...how can i make it go to the bottom of the entries instead
of a set range.
i have: cells(rows.count,1).End(xlup)(2).Select, but im not sure how to
incorporate both.

next part of question, how can i make data.xls hidden? and if so...can it be
shared?

thank you in advance

"Patrick Molloy" wrote:

Set destSheet = Workbooks("data.xls").Worksheets("data")
Set sourceSheet = Workbooks("register.xls").Worksheets("register")
DestSheet.Range("a1:a10").Value = sourceSheet.Range("a1:a10").Value

--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"choice" wrote in message
...
i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance




  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default different workbooks

i need the opposite of that...
i need the beginning of the range to be the last value in the column

example:
on data.xls column A, there are 25 entries already, i need the range to
start on the 26th cell and start the range from there on.

thank you

"Norman Jones" wrote:

Hi Choice,

but on destsheet...how can i make it go to the bottom of the entries
instead
of a set range.


Dim rng As Range
Dim LastCell As Range

Set LastCell = destsheet.Cells(Rows.Count, 1).End(xlUp)
Set rng = destsheet.Range("A1", LastCell)

next part of question, how can i make data.xls hidden?


Windows("data.xls").Activate
Windows("data.xls").Visible = False

...can it be shared?


Not sure what you mean by "shared", but you can read and write to a hidden
workbook.

---
Regards,
Norman



"choice" wrote in message
...
WORKED...thank you

Next question has a couple parts.
so i have,
Set destSheet = Workbooks("data.xls").Worksheets("data")
Set sourceSheet = Workbooks("register.xls").Worksheets("register")
DestSheet.Range("a1:a10").Value = sourceSheet.Range("a1:a10").Value

but on destsheet...how can i make it go to the bottom of the entries
instead
of a set range.
i have: cells(rows.count,1).End(xlup)(2).Select, but im not sure how to
incorporate both.

next part of question, how can i make data.xls hidden? and if so...can it
be
shared?

thank you in advance

"Patrick Molloy" wrote:

Set destSheet = Workbooks("data.xls").Worksheets("data")
Set sourceSheet = Workbooks("register.xls").Worksheets("register")
DestSheet.Range("a1:a10").Value = sourceSheet.Range("a1:a10").Value

--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"choice" wrote in message
...
i have :

Sub inputdata()

Set destSheet = Worksheet("data")
Set sourceSheet = Worksheet("register")
Workbooks("data.xls").Activate
DestSheet(Range("a1:a10")).Value =
sourceSheet(Range("a1:a10")).Value


my question/problem is that destsheet and sourcesheet are in different
workbooks...how would i add that in my code? i tried some stuff but
couldnt
get it
the 2 workbooks are data.xls and register.xls
thanks in advance






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
Regular Workbooks vs. Binary Workbooks Jerry Excel Discussion (Misc queries) 1 April 28th 10 04:03 AM
Updating Workbooks from multiple links Workbooks TimJames Excel Worksheet Functions 1 December 15th 07 03:34 PM
Copy/ move selected data from workbooks to seperate worksheets or workbooks Positive Excel Worksheet Functions 1 August 30th 07 04:54 PM
Display 2 formulas from source workbooks to destination workbooks Excel_seek_help Excel Discussion (Misc queries) 4 April 27th 06 08:13 PM
suddenly my excel workbooks are "shared workbooks" Maggie's mom Excel Discussion (Misc queries) 1 August 28th 05 09:20 PM


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