Hey,
I'm trying to run a loop which will do something when there is a value in the cell, but skip the cell (or delete the row) when there is no value.
I pulled this from another thread, but it isn't working for me:
Sub DeleteBlankRows()
'Evaluates column A only
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete xlShiftUp
End Sub
I think it might be because my blank cells have a formula, so they aren't really blank? I have a formula like this: =IF(M2="Yes",I2,"")
Here is the part of code I am trying to loop through in case my above description is not enough information (only the beggining is giving me trouble, and the red section could change depending if I delete the rows or skip them):
Application.DisplayAlerts = False
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete xlShiftUp
'new
Range("A2").Select
'new
Do Until ActiveCell.Value = ""
'new
currentfund = ActiveCell.Value
Dim MonarchObj As Object
Dim openfile, openmod, t As Boolean
'If Monarch is currently active GetObject will use Monarch. If it is not use the CreateObject() to
'open another copy of Monarch.
Set MonarchObj = GetObject("", "Monarch32")
If MonarchObj Is Nothing Then
Set MonarchObj = CreateObject("Monarch32")
End If
t = MonarchObj.SetLogFile("C:\Temp\MPrg_G5.log", False)
'----------------------------------------
'Edit below this line
openfile = MonarchObj.SetReportFile("c:\TEMP\r104" & currentfund & ".exp", False)
If openfile = True Then
openmod = MonarchObj.SetModelFile("\\fpcmsbos212vs1\vol1\common\shared\Templates and Macros\Monarch Models\R104.MOD")
If openmod = True Then
'Set filter for each frame and export to Excel
'MonarchObj.CurrentFilter = "Amount"
MonarchObj.ExportTable ("\\fpcmsbos212vs1\vol1\common\shared\Templates and Macros\Macros\Term CATs\Downloads\r104" & currentfund & ".xls")
End If
End If
MonarchObj.Exit
'new
ActiveCell.Offset(1, 0).Select
Loop
Bookmarks