is this code working ???

gopdeep

Board Regular
Joined
Apr 24, 2012
Messages
94
Code:
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column

For j = CInt(col) To lastcol Step 2
    For i = 1 To lastrow
        If IsEmpty(Cells(i, j).Value) Then
            Cells(i, j).Value = "Not in Scope"
        End If
    Next i
Next j
:confused:
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
"Re: is this code working ???"

Maybe yes, maybe no. Depends on what you think "working as expected" means.
 
Last edited:
Upvote 0
code should paste "Not in Scope" if any cell is empty and this should be done column wise.

Code:
If IsEmpty(Cells(i, j).Value) Then
 
Upvote 0
what is
Rich (BB code):
 j = CInt(col) To lastcol Step 2
dimmed as
 
Upvote 0
am getting "col" as input (-> below) which was declared as String, so that converting that in to integer.

Code:
col = InputBox("enter column number")
 
Upvote 0
Ok, so how about posting ALL the code ....as per my tag !
 
Upvote 0
You don't need to loop through the range. Something like this...

Code:
Sub test()
Dim lastrow As Long
Dim lastcol As Long


lastrow = Cells(Rows.Count, 1).End(xlUp).Row
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column

Range(Cells(2, col), Cells(lastrow, lastcol)).SpecialCells(xlCellTypeBlanks) = "Not in scope"

End Sub
 
Upvote 0
Yeah, nice call Neil....much faster than
I took as stab and came up with...
Code:
Sub tst()
Dim lastrow As Long, lastcol As Integer, j As Integer, i As Long, col As String
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
col = InputBox("please insert column No")
For j = CInt(col) To lastcol Step 2
    For i = 1 To lastrow
        If IsEmpty(Cells(i, j).Value) Then
            Cells(i, j).Value = "Not in Scope"
        End If
    Next i
Next j
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,125
Messages
6,053,655
Members
444,676
Latest member
locapoca

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top