Hello,
i have got several stock data sets and would like to delete automatically every date with an volume of zero.
I have for every stock another loop, is it possible to shorten this? By now I have only 3 stocks that makes it easy to handle, but i assume that it will be confusing with more stocks as I have to add another loop for every stock.
The code is part of an portfolio optimization code, I'm starting to set up...
Dim i As Integer, j As Integer, k As Integer
Dim letzteZeileBMW As Long: letzteZeileBMW = wsBMW.Cells(2, 6).End(xlDown).Row
Dim lZBASF As Long: lZBASF = wsBASF.Cells(2, 6).End(xlDown).Row
Dim lZRWE As Long: lZRWE = wsRWE.Cells(2, 6).End(xlDown).Row
For i = 1 To letzteZeileBMW
With wsBMW
If .Cells(i, 6) = "0" Then
.Rows(i).Delete
End If
End With
Next i
For j = 1 To lZBASF
With wsBASF
If .Cells(j, 6) = "0" Then
.Rows(j).Delete
End If
End With
Next j
For k = 1 To lZRWE
With wsRWE
If .Cells(k, 6) = "0" Then
.Rows(k).Delete
End If
End With
Next k
Thank you very much for your help!
Bookmarks