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
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

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
 

Watch MrExcel Video

Forum statistics

Threads
1,123,088
Messages
5,599,664
Members
414,325
Latest member
kfg1287

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