View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
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.