ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HOW ? Running a different Macro if value reached (https://www.excelbanter.com/excel-programming/281321-how-running-different-macro-if-value-reached.html)

bertieBassett

HOW ? Running a different Macro if value reached
 
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



bertieBassett

HOW ? Running a different Macro if value reached
 
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" wrote in message
...
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





Chip Pearson

HOW ? Running a different Macro if value reached
 
Change

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

to

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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"bertieBassett" wrote in message
...
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





Chip Pearson

HOW ? Running a different Macro if value reached
 
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


"bertieBassett" wrote in message
...
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" wrote in message
...
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








All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com