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

Can anyone clarify this? I have a variable named in my macro (aveemax)
and I am trying to divide a range by this number. I would imagine it's
possible to divide a range by a single number, but I would also imagine
that this error means that it doesn't want to do this. The code in
question is below.

Worksheets("Sheet1").Activate
Dim TempGPCR1 As Range
Dim GPCR1data As Range
Dim i As Long
For i = 1 To numCpd1
Worksheets("Sheet1").Activate
Set TempGPCR1 = Application.InputBox("Please Select Data
for Compound " & i, Type:=8)
Worksheets("Sheet3").Activate
Range("A" & i + 1) =
Application.WorksheetFunction.Average(TempGPCR1(i) )
Next i

Worksheets("Sheet1").Activate
Dim Emax1 As Range
Set Emax1 = Application.InputBox("Please Select Data for
Emax", Type:=8)

aveemax1 = WorksheetFunction.Average(Emax1)
Worksheets("Sheet3").Activate
[H8].Value = aveemax1

Dim r1 As Range
Set r1 = aveemax1 * TempGPCR1

Is there just something wrong with my code? I have tried it numerous
ways and it always gives me this mismatch error.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Error 13...Mismatch

The statements:
Dim r1 As Range
Set r1 = aveemax1 * TempGPCR1
are your problem. You declare r1 to be a range, then you set r1 to
something that isn't a range.
As an aside, you should put all your declarations at the top of the macro.
HTH Otto
wrote in message
oups.com...
Can anyone clarify this? I have a variable named in my macro (aveemax)
and I am trying to divide a range by this number. I would imagine it's
possible to divide a range by a single number, but I would also imagine
that this error means that it doesn't want to do this. The code in
question is below.

Worksheets("Sheet1").Activate
Dim TempGPCR1 As Range
Dim GPCR1data As Range
Dim i As Long
For i = 1 To numCpd1
Worksheets("Sheet1").Activate
Set TempGPCR1 = Application.InputBox("Please Select Data
for Compound " & i, Type:=8)
Worksheets("Sheet3").Activate
Range("A" & i + 1) =
Application.WorksheetFunction.Average(TempGPCR1(i) )
Next i

Worksheets("Sheet1").Activate
Dim Emax1 As Range
Set Emax1 = Application.InputBox("Please Select Data for
Emax", Type:=8)

aveemax1 = WorksheetFunction.Average(Emax1)
Worksheets("Sheet3").Activate
[H8].Value = aveemax1

Dim r1 As Range
Set r1 = aveemax1 * TempGPCR1

Is there just something wrong with my code? I have tried it numerous
ways and it always gives me this mismatch error.



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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
xpath error? Runtime Error 13 type mismatch Steve M[_2_] Excel Discussion (Misc queries) 0 January 17th 08 01:16 AM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Type Mismatch error & subscript out of range error Jeff Wright[_2_] Excel Programming 3 May 14th 05 07:14 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 08:19 AM.

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"