LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Copy FROM - TO Object/Block variable not set

The workbook "Copy To WKBook.xlsm" is a saved workbook.

When I enter "Range("A1:A5") into InputBox ColRngFrm prompt I get the error message per subject title.

I'd be happier if I could just enter the Column letter, say "D" and all the "A's" in the ColRngFrm would convert to D's for a range to copy from...

ColRngFrm = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)

....and then enter the column letter in the ColRngTo for the column to copy to in the other workbook, say C, and get for a column to copy to...

ColRngTo Range("C:C")

Thanks.
Howard

Option Explicit

Sub CopyBookToBook()

Dim ColRngFrm As Range
Dim ColRngTo As Range

ColRngFrm = InputBox(Prompt:="Enter a Copy from Range.", _
Title:="Enter Copy from Column", Default:="The range to copy from")
If ColRngFrm = "The range to copy from" Or ColRngFrm = vbNullString Then Exit Sub

ColRngTo = InputBox(Prompt:="Enter a Copy to Range.", _
Title:="Enter Copy to Column", Default:="The range to copy to")
If ColRngTo = "The range to copy to" Or ColRngTo = vbNullString Then Exit Sub
MsgBox ColRngTo

Workbooks("Copy To WKBook.xlsm").Sheets("Sheet1").Range("ColRngTo").V alue = _
ThisWorkbook.Sheets("Sheet1").Range("ColRngFrm").V alue

End Sub
 
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
Runtime Error 91 Object variable or With block variable not set. Tim Excel Programming 9 June 5th 08 10:03 PM
Run-Time error '91': Object variable of With block variable not set jammin1911 Excel Programming 3 June 6th 06 06:36 PM
Run-time Error'91: Object variable or With block variable not set DynamiteSkippy Excel Programming 4 September 26th 05 07:47 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


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