last day (15 days later) » 

5:22 AM
0
Q: How to detect 3 consecutive empty rows in excel

HarperI am new to VBA so sorry for the silly question. I would like to detect if there are 3 consecutive empty rows in a column. I am aware that I could probably do 2 consecutive empty rows using code below: While (lastCell <> "") Or (curCell <> "") lastCell = curCell ActiveCell.Offset(1, 0...

 
3 consecutive empty rows or 3 consecutive empty Cells say in Col A?
 
Hi @SiddharthRout it's 3 consecutive empty rows in one Col A
 
Let me rephrase. Do you want to check if the complete row is empty (for example A1:XFD1 in Excel 2007+) or just A1?
So in first example you compare A1:XFD1 with A2:XFD2 and so on. In the 2nd you compare A1 with A2 and so on...
 
I want to check for just single cell A1 at a time, then for the whole column A
@SiddharthRout So basically I suspect that there are 3 consecutive empty rows in a column Col A, but I would like to check where are they
 
I posted an answer. You may have to refresh the page to see it.
 
5:22 AM
@SiddharthRout Thank you so much for your answer. I tried to run the code but nothing happened. Please see the edited question for the screenshot.
 
Hi Harper
Can you share a screenshot of your Sheet?
 
Sure, one sec please
Sorry how do I send a pic?
A	B	C
4
	1
		8
8
	1
		8
18
	3
		9
4
	1
		3
18
	2
		4
44
	2
		17
16
	1
		15
6
	1
		12
It looks like this
 
But there are only 2 blank spaces?
fo example between 8 and 18 there are only 2 blank spaces?
i thought you said 3?
 
Yes
 
but i can see only 2 betweeb 8/18 or 18/4 and so on?
 
5:31 AM
After deleting all empty cells, I realised that col A is short of 1 value as compared to col B and C
So my guess is that there are3 empty cells...
So could you tell if I have run the code properly?
 
You want to check in col A? So I do not undertsand the relevance of Col B and Col C?
Did you see the image that I posted in my answer. The yellow cells are the blank cells in Col A.
 
The assumption is that they have same value, which is true. But some value is missing from A, and I can't tell which it is. But I guess it'll leave 3 empty cells in the middle for A
Let me try it on another sample
 
yes but in your example that you posted above there are only 2 consecutive cells which are empty. For example between 4 and 8 in Col A there are only 2 blank cells
See this only the yellow cells will be identified as there are 3 consecutive blank cells. row 8 and 9 will not get identified...
 
Yes I just tried another sample and it's the same result
 
you have to press print screen button or use the snip tool to take a screenshot
and then save the image before you upload it here
 
5:41 AM
Okay thanks
I cannot do it on Mac right?
 
you are on MAC?
 
Yes
 
Press Command+Shift+3
the screenshot will be saved on your desktop
 
I have taken the screenshot, but I cannot upload them
 
you have a upload button below
 
5:46 AM
When I drag the pic to the window, the whole window will turn black with the pic in the middle. There is no option buttons or whatsoever
 
which browser are u using?
 
Actually the original question was that I want to spread the rows in to columns, I couldn't think of a better way so I did it manually. I think maybe you could help me with this, given your expertise
 
Remember I asked you?

>3 consecutive empty rows or 3 consecutive empty Cells say in Col A?
Till the time you are not clear with what you want, it will be difficult to explain
You said
>I want to check for just single cell A1 at a time, then for the whole column A
So I gave you a code for that.
Do this. Upload your screenshot in
http://wikisend.com/
And share the link here
 
It's about 3 consecutive cells, not rows. I just want to look at the col A
 
yup and that is what my code does
 
5:51 AM
Maybe I didn't run it properly
 
do you mean A1, B1, and C1 should be empty?
 
I created a file like the one you showed and it's the same
A1 is the heading
 
Do this. Upload your screenshot in
wikisend.com
it will be much faster
 
"We are sorry, but the requested file doesn't exist or has expired and is no longer available."
Sorry there is some error
 
take your time :) i am also starting my mac
 
5:55 AM
It's okay..
"Compile error:

Invalid outside procedure"
I tried your example and it returned this message
I am just very new to VBA and I'm not sure if I was doing it correctly
Btw do you mind if I ask you another question?
 
ok i am saying this for the3rd time :)
Upload your screenshot in
wikisend.com
 
We are sorry, but the requested file doesn't exist or has expired and is no longer available.

You can return to the download page and try again.
I couldn't upload it. This is the error.
 
do you have a dropbox? google drive?
 
Do you have telegram?
 
one moment. I tested it in Mac and it is working just fine... one moment. uploading a screenshot
 
6:07 AM
It still returns the error every time I run something "Compile error:

Invalid outside procedure"
Did I miss anything that?
Did I miss anything?
 
Can you upload your excel file to wikisend.com?
save and close the file before you upload
 
Sorry I tried but it didn't seem to work
If you don't mind, I . could add you on telegram or whatsapp
yeah
 

last day (15 days later) »