Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks to Claus for these two codes.
Normally you would have the "Copy WkBook To" open and both codes work well. I added the open "Copy WkBook To" code line to both so that you would not have to open it manually, the code would do it. Sub CopyBookToBookClaus_Rangex() works just fine. Sub CopyBookToBook2Claus_ColLetterx() opens the other workbook but does not complete the column copy after entering a destination column letter in the second InPut prompt. What am I missing here? Thanks. Howard Option Explicit Sub CopyBookToBookClaus_Rangex() Dim ColRngFrm As Range Dim ColRngTo As Range Set ColRngFrm = Application.InputBox(Prompt:="Enter a Copy from Range.", _ Title:="Enter Copy from Column", Type:=8) If ColRngFrm Is Nothing Then Exit Sub Workbooks.Open Filename:= _ "C:\Users\Howard Kittle\Documents\Copy WkBook TO.xlsm" Application.Goto Workbooks("Copy WkBook To").Sheets("Sheet1").Range("A1") Set ColRngTo = Application.InputBox(Prompt:="Enter a Copy to Range.", _ Title:="Enter Copy to Column", Type:=8) If ColRngTo Is Nothing Then Exit Sub MsgBox ColRngTo.Address ColRngFrm.Copy ColRngTo End Sub Sub CopyBookToBook2Claus_ColLetterx() Dim ColRngFrm As String Dim ColRngTo As String Dim LRow As Long LRow = Cells(Rows.count, 1).End(xlUp).Row ColRngFrm = Application.InputBox(Prompt:="Enter a column letter.", _ Title:="Enter a column letter", Type:=2) If ColRngFrm = "" Or ColRngFrm = "False" Then Exit Sub Workbooks.Open Filename:= _ "C:\Users\Howard Kittle\Documents\Copy WkBook TO.xlsm" Application.Goto Workbooks("Copy WkBook To").Sheets("Sheet1").Range("A1") ColRngTo = Application.InputBox(Prompt:="Enter a column letter.", _ Title:="Enter a column letter", Type:=2) If ColRngTo = "" Or ColRngTo = "False" Then Exit Sub Range(Cells(1, ColRngFrm), Cells(LRow, ColRngFrm)).Copy _ Workbooks("Copy WkBook TO").Sheets("Sheet1").Cells(1, ColRngTo) End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem: Closing one book causes the 2nd book freeze | Excel Programming | |||
copy worksheets to new book without linking to original book | Excel Discussion (Misc queries) | |||
to disconnect a destination book from a source book | Excel Discussion (Misc queries) | |||
'BeforeClose' code problems:book won't close if more than one book is open | Excel Programming | |||
Open book, check for macros, close book | Excel Programming |