Sub test()
For i = 1 To Columns.Count
If Cells(1, i).End(xlDown).Row = Rows.Count Then
MsgBox "The first empty column is: " & Columns(i).Address
Exit For
End If
Next i
End Sub
Would it be easier or more efficient code if blank cells in the first row represented the blank column (those that have data, have a value in row 1)?
Maybe
Code:
blankCol = Cells(1, Columns.Count).End(xlToLeft).Column
If blankCol >= 1 Then
blankCol = blankCol + 1
End If
The problem with this is- it detects the first blank column from the right (on the end) and does not identify the first blank between columns that have data (which would be from the left).
Yes, working in VBA. I had the code from post #5 to find the first blank row on the end, but wanted to see how to find first blank between data. Your VBA code above seems to be working well for me.
I have a query in column "A". Whenever I key in data in column b, c, d, e -- it's applying sort of a filter style to the column and it won't let me clear the contents. So this is screwing things up for me.
How can I keep Excel from applying the auto-filter or whatever it is from the query in column A -- over to the other columns that get data?
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.