Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Range Type Mismatch Excel vs Spreadsheet 9.0

Hi guys,
Hopefully a simple question, but It's driving me crazy ...
I have a book, with one sheet and one form. Inside the form a embbed a
Spreadsheet 9.0 object.
Sheet1 has 2 values, let's say "value 1" and "value 2", on cells A1 and
A2 (very simple so far)
I want to: upload the values whe the form appears, and unload changes
when the form disappears (hopefully still simple). Loading no problem.
Unloading d$%"$·!.
So here's the code inside UserForm1:

Private Sub UserForm_Initialize()
Sheet1.Range("A1").CurrentRegion.Copy
Spreadsheet1.Cells.Range("A1").Paste
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Dim myRange As Range
Set myRange = Spreadsheet1.Cells.Range("A1").CurrentRegion '<<<
TYPE MISMATCH ERROR
myRange.Copy
Sheet1.Paste
End Sub

As far as I can see, myRange is Range but
Spreadsheet1.Cells.Range("A1").CurrentRegion is a VALUE!!!
Look the Inmidiate:
print Spreadsheet1.Cells.Range("A1").CurrentRegion
value 1

print Spreadsheet1.Cells.Range("A1").CurrentRegion.Count
2
Why CurrentRegion is a VALUE!!!! why why why why why why why why!!!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Range Type Mismatch Excel vs Spreadsheet 9.0

try this

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)

Dim MyRange as OWC.Range
set MyRange = me.SpreadSheet1.Cells.Range("A1").CurrentRegion
rng.copy
Sheet1.Paste
End Sub

In the debug window you are getting the default property (value) of the
OWC.Range object.

You should use

? Typename(me.SpreadSheet1.Cells.Range("A1").Current Region)

But I don't think the result will be helpful since it will just report
Range.

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
Hi guys,
Hopefully a simple question, but It's driving me crazy ...
I have a book, with one sheet and one form. Inside the form a embbed a
Spreadsheet 9.0 object.
Sheet1 has 2 values, let's say "value 1" and "value 2", on cells A1 and
A2 (very simple so far)
I want to: upload the values whe the form appears, and unload changes
when the form disappears (hopefully still simple). Loading no problem.
Unloading d$%"$·!.
So here's the code inside UserForm1:

Private Sub UserForm_Initialize()
Sheet1.Range("A1").CurrentRegion.Copy
Spreadsheet1.Cells.Range("A1").Paste
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Dim myRange As Range
Set myRange = Spreadsheet1.Cells.Range("A1").CurrentRegion '<<<
TYPE MISMATCH ERROR
myRange.Copy
Sheet1.Paste
End Sub

As far as I can see, myRange is Range but
Spreadsheet1.Cells.Range("A1").CurrentRegion is a VALUE!!!
Look the Inmidiate:
print Spreadsheet1.Cells.Range("A1").CurrentRegion
value 1

print Spreadsheet1.Cells.Range("A1").CurrentRegion.Count
2
Why CurrentRegion is a VALUE!!!! why why why why why why why why!!!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Range Type Mismatch Excel vs Spreadsheet 9.0

I knew it!!!!!! OWC!!!! thanks Tom

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
Setting range object--Type mismatch if template not used [email protected] Excel Programming 2 April 25th 06 05:20 PM
Type mismatch using rnge as Range with Type 8 Input Box STEVE BELL Excel Programming 11 December 3rd 05 05:02 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Type mismatch on range name davegb Excel Programming 2 June 8th 05 06:15 PM
Type mismatch in VBA LinEst function if range too large RyanVM[_16_] Excel Programming 4 August 10th 04 02:47 AM


All times are GMT +1. The time now is 04:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"