ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Issue with my Loop Function (https://www.excelbanter.com/excel-programming/420145-issue-my-loop-function.html)

Ana

Issue with my Loop Function
 
Sub Ana()

Dim iInputRow As Long
Dim iEquityRow As Long
Dim iSpotFxRow As Long
Dim iOptionFXRow As Long
Dim iOptionRow As Long
Dim iCFDRow As Long
Dim iFutureRow As Long
Dim sType As String

iInputRow = 2
iEquityRow = 2


While InputSheet.Cells(iInputRow, 2) < ""
sType = InputSheet.Cells(iInputRow, 3)


If sType = "Equity" Then
'paste equity

End If


Wend


End Sub


This part: While InputSheet.Cells(iInputRow, 2) < ""

Is giving me an error and I'm not quite sure why?
Could someone help me?



Bernard Liengme

Issue with my Loop Function
 
What do you mean by: InputSheet ?
You seem to have an endless loop
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Ana" wrote in message
...
Sub Ana()

Dim iInputRow As Long
Dim iEquityRow As Long
Dim iSpotFxRow As Long
Dim iOptionFXRow As Long
Dim iOptionRow As Long
Dim iCFDRow As Long
Dim iFutureRow As Long
Dim sType As String

iInputRow = 2
iEquityRow = 2


While InputSheet.Cells(iInputRow, 2) < ""
sType = InputSheet.Cells(iInputRow, 3)


If sType = "Equity" Then
'paste equity

End If


Wend


End Sub


This part: While InputSheet.Cells(iInputRow, 2) < ""

Is giving me an error and I'm not quite sure why?
Could someone help me?





GollyJer

Issue with my Loop Function
 
Doesn't look like you're looping.
Before Wend should you add
iInputRow = iInputRow + 1


"Ana" wrote in message
...
Sub Ana()

Dim iInputRow As Long
Dim iEquityRow As Long
Dim iSpotFxRow As Long
Dim iOptionFXRow As Long
Dim iOptionRow As Long
Dim iCFDRow As Long
Dim iFutureRow As Long
Dim sType As String

iInputRow = 2
iEquityRow = 2


While InputSheet.Cells(iInputRow, 2) < ""
sType = InputSheet.Cells(iInputRow, 3)


If sType = "Equity" Then
'paste equity

End If


Wend


End Sub


This part: While InputSheet.Cells(iInputRow, 2) < ""

Is giving me an error and I'm not quite sure why?
Could someone help me?



Mike

Issue with my Loop Function
 
While Len(InputSheet.Cells(iInputRow, 2).Formula) 0
sType = InputSheet.Cells(iInputRow, 3)
If sType = "Equity" Then
'paste equity
End If
iInputRow = iInputRow + 1
Wend

"Ana" wrote:

Sub Ana()

Dim iInputRow As Long
Dim iEquityRow As Long
Dim iSpotFxRow As Long
Dim iOptionFXRow As Long
Dim iOptionRow As Long
Dim iCFDRow As Long
Dim iFutureRow As Long
Dim sType As String

iInputRow = 2
iEquityRow = 2


While InputSheet.Cells(iInputRow, 2) < ""
sType = InputSheet.Cells(iInputRow, 3)


If sType = "Equity" Then
'paste equity

End If


Wend


End Sub


This part: While InputSheet.Cells(iInputRow, 2) < ""

Is giving me an error and I'm not quite sure why?
Could someone help me?




All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com