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

Change

a = [[main.xls]input'!V2]

to

a = Workbooks("Main.xls").Worksheets("Input").Range("V2").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
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 (e-mail address removed)


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top