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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,215,730
Messages
6,126,528
Members
449,316
Latest member
sravya

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
Back
Top