HOW ? Running a different Macro if value reached

B

bertieBassett

My problem is
1. I am thick .....
2. I Need help
3. Medical Sceince says I am incurable ..............

I need to use a value from the worksheet to define a value within a macro

' this macro
named Main
a = [[main.xls]input'!V2] ' get value of A from sheet
named & cell
If a < 5 Then NGroup ' go to & run NGroup Marco
If a > 5 Then MGroup ' go to & run MGroup Macro

I get a type mismatch error
how do i overcome this ?????
all assistance apreciated
 
B

bertieBassett

have sorted part of the problem but now have come across a diferent one

a = [[main.xls]input'!V2] ' get value of A
If a < 5 Then NGroup
If a > 5 Then Newk
End If
End If
End Sub
but i now get a "End If without Block If"
do i need to put End If statements in NGroup / MGroup
 
C

Chip Pearson

You don't need an End If if you but the "Then" instruction on the same line
as the If.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com [email protected]


bertieBassett said:
have sorted part of the problem but now have come across a diferent one

a = [[main.xls]input'!V2] ' get value of A
If a < 5 Then NGroup
If a > 5 Then Newk
End If
End If
End Sub
but i now get a "End If without Block If"
do i need to put End If statements in NGroup / MGroup

bertieBassett said:
My problem is
1. I am thick .....
2. I Need help
3. Medical Sceince says I am incurable ..............

I need to use a value from the worksheet to define a value within a macro

' this macro
named Main
a = [[main.xls]input'!V2] ' get value of A from sheet
named & cell
If a < 5 Then NGroup ' go to & run NGroup Marco
If a > 5 Then MGroup ' go to & run MGroup Macro

I get a type mismatch error
how do i overcome this ?????
all assistance apreciated
 
Top