Forum Discussion
jstromb
Jul 01, 2021Copper Contributor
formulas for returning values if another cell is blank
I am only working on one sheet and need a formula to display a value only if another cell has data in it: If D44 is empty (or blank), then G44 will be blank. Otherwise I want to return the following value in G44: (F44*24)*D$1.
I'm not sure if I can use IF with ISBLANK....
Thank you!!
Sub companyemployees() Dim i As Double Dim j As Double Dim z As Double Dim w As Double For i = 2 To 1000 j = Cells(i, 2).Value For z = 2 To j + 1 Cells(z + w, 4).Value = Cells(i, 1).Value Cells(z + w, 5).Value = Cells(i, 2).Value Next z w = w + z - 2 Next i End Sub
Maybe with these lines of VBA code. Click the button in cell G2 in the attached file to start the macro.
4 Replies
Sort By