View Single Post
 
Old 09-08-2018, 04:40 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
Here is the updated macro :

Code:
Option Explicit

Sub numcells()
Dim i As Integer
Dim x As Range

    For Each x In Range("B5:B100")  '<-- Edit range as required.
    
        If IsNumeric(x.Offset(0, -1).Value) And x.Offset(0, -1).Value > 0 Then
            i = x.Offset(0, -1).Value
        End If
       
        If x <> "" Then
            If x.Offset(0, -1) = "" Then
                x.Offset(0, -1) = i
                i = i + 1
            End If
        End If
        
    Next
End Sub
Attached Files
File Type: xlsm Number NonBlank Rows (1).xlsm (18.8 KB, 10 views)
Reply With Quote