Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling function form within sub
All
I am trying to call a function form within a sub, but VBA doesn't accept the swapRows function and asks for a =. Why? Dirk Function swapRows(areaSwap1 As Range, areaSwap2 As Range) ' a lot of code End Function Sub schedule() Dim ran As Range Dim num As Integer Set ran = InputBox("select range including heading for columns", Type:=8) num = ran.Rows.Count For i = 2 To num If isempty(ran(i, 2)) Then swapRows(ran.Row(i),ran.Row(i+1)) Next i End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling function form within sub
change it to
If isempty(ran(i, 2)) Then call swapRows(ran.Row(i),ran.Row(i+1)) or If isempty(ran(i, 2)) Then swapRows ran.Row(i), ran.Row(i+1) this is the syntax of VBA/VB. -- Regards, Tom Ogilvy "Dirk" wrote: All I am trying to call a function form within a sub, but VBA doesn't accept the swapRows function and asks for a =. Why? Dirk Function swapRows(areaSwap1 As Range, areaSwap2 As Range) ' a lot of code End Function Sub schedule() Dim ran As Range Dim num As Integer Set ran = InputBox("select range including heading for columns", Type:=8) num = ran.Rows.Count For i = 2 To num If isempty(ran(i, 2)) Then swapRows(ran.Row(i),ran.Row(i+1)) Next i End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
calling a function in a worksheet from a user form | Excel Programming | |||
How to pass a variable from Form back to calling procedure | Excel Programming | |||
Calling the Print Form | Excel Programming | |||
Calling Com addin from form button on sheet? | Excel Programming | |||
Calling variable from user form | Excel Programming |