If cell is blank

Can an expert provide me with the code where the cell I am on is blank so I need to go to next oiece of code.

Thanks
JagwarmanAsked:
Who is Participating?
 
Saqib Husain, SyedConnect With a Mentor EngineerCommented:
If activecell <> "" then
    activecell.currentregion.copy
else
    Msgbox " No Date"
endif
0
 
Saqib Husain, SyedConnect With a Mentor EngineerCommented:
Try either of these sequences
if activecell<>"" then
.
.
end if

Open in new window


if activecell="" then
.
.
end if

Open in new window

0
 
SeanStricklandConnect With a Mentor Commented:
Can you give a little more information on what you're looking for?  Until then, here's a quick sample of some code that does this.  You can insert this into your worksheet's module.  (right-click your worksheet tab and click view code).

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If IsEmpty(Target) Then
    MsgBox "Cell is blank... do whatever."
End If
End Sub

Open in new window

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
JagwarmanAuthor Commented:
Sorry need to clarify this.

If the cell I am on is not blank then copy from that cell down to last non blank cell and also copy across rows. i.e. if I am on A50 and A70 is last non blank copy A50:X70 because Column X71 and beyond are blank cells

But if A50 is Blank then put out Msg" No Date"

Thanks
0
 
JagwarmanAuthor Commented:
Thanks
0
 
JagwarmanAuthor Commented:
Hi ssaqibh

Love the code but I found a slight fault in that your code stops at first blank cell in the row but I need to get all data in that row. i.e. if C4 is blank but D4 through S4 are not blank and T4 is blank and U4 through AC4 are not blank I need to copy from C4 through AC4

Thanks
0
 
Saqib Husain, SyedEngineerCommented:
If it is one row then try

range(activecell,cells(activecell.row,columns.count).end(xltoleft)).copy
0
 
JagwarmanAuthor Commented:
Unfortunately it's not it can be many :-(
0
 
Saqib Husain, SyedEngineerCommented:
If it is many then currentregion should work otherwise then columns.count should work
0
 
Saqib Husain, SyedEngineerCommented:
Maybe you can try something like

If activecell <> "" then
    if activecell.currentregion.rows.count=1 then
        range(activecell,cells(activecell.row,columns.count).end(xltoleft)).copy
    else
        activecell.currentregion.copy
    endif
else
    Msgbox " No Date"
endif
0
 
JagwarmanAuthor Commented:
ok thanks ssaqibh
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.