View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dirk[_4_] Dirk[_4_] is offline
external usenet poster
 
Posts: 6
Default 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