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 |
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 |
All times are GMT +1. The time now is 03:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com