Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Regular Workbooks vs. Binary Workbooks | Excel Discussion (Misc queries) | |||
Updating Workbooks from multiple links Workbooks | Excel Worksheet Functions | |||
Copy/ move selected data from workbooks to seperate worksheets or workbooks | Excel Worksheet Functions | |||
Display 2 formulas from source workbooks to destination workbooks | Excel Discussion (Misc queries) | |||
suddenly my excel workbooks are "shared workbooks" | Excel Discussion (Misc queries) |