macro problems

sueandco

New Member
Joined
Oct 19, 2002
Messages
31
Hi i have a counter macro that works, what i want to do is compare the counter results with a named cell.
Here is counter that works.
Sub Next_riser()

Application.Goto Reference:="Next"
Selection.Copy
Application.Goto Reference:="NumR"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


End Sub
And this is the macro that i want to use to set off the other macro:
Sub setoffmacro()

If "NumR" = "Number_of_risers" Then
Exit Sub

If "Number_of_risers" < "NumR" Then
Application.Run "Drawingstairs.xls!Next_riser"
Range("K25").Select
Selection.Copy
Range("M25").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("M29").Select


End If
End If

End Sub
Any help welcome
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
Hi sueandco,

If these named ranges are on the active worksheet then the following should work:

Sub setoffmacro()

If [NumR] = [Number_of_risers] Then
Exit Sub

If [Number_of_risers[ < [NumR] Then

In addition, unless Next_riser is in a different workbook from this code, you don't need the Run method for

Application.Run "Drawingstairs.xls!Next_riser"

but rather just

Next_riser
 

sueandco

New Member
Joined
Oct 19, 2002
Messages
31
Hi,
This worked
If Range("K29") = Range("H6") Then
Exit Sub

Else

Application.Run "Drawingstairs.xls!Next_riser"
Range("K25").Select
Selection.Copy
Range("M25").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("M29").Select



End If

End Sub
Thanks for your help
Sue
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,038
Messages
5,856,980
Members
431,843
Latest member
Malahhai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top