delete a cell if no content

PARSMS

New Member
Joined
Jun 21, 2018
Messages
2
Hi
I'm a brand newbie on VBA
I have a workbook called "input" that retrieves information from other workbooks (a,b,c) in a excel spreadsheet, if column G, in each workbook has content

on workbook "input", each column has the content from workbooks a, b and c when column G in that workbook has content

therefore I have lots of lines in each column that come empty, that I would like to eliminate

how to do it?

many thanks in advance for the support
BR
Paula
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
So which columns do we need to search.

Is it column A B and C

And delete any cell that is empty
 
Upvote 0
This will delete blank cells in columns A:C:

Code:
Range("A:C").SpecialCells(xlCellTypeBlanks).Delete shift:=xlUp

or you can do it manually...select columns A:C --Home Tab--Find and Select--Go To Special--Blanks--OK...then right click and delete them and shift them whichever way you like...I'd assume up.
 
Last edited:
Upvote 0
Try this:
Code:
Sub Delete_Blank_Cells()
'Modified 6/21/18 6:00 AM EDT
On Error Resume Next
Dim Lastrow As Long
Dim i As Long
For i = 1 To 3
Lastrow = Cells(Rows.Count, i).End(xlUp).Row
Cells(1, i).Resize(Lastrow).SpecialCells(xlCellTypeBlanks).Cells.Delete
Next
On Error GoTo 0
End Sub
 
Upvote 0
So which columns do we need to search.

Is it column A B and C

And delete any cell that is empty

hi
lets try to say it in a different way
if a cell on column G, in workbook A has content, this content will be shown in Column A in workbook "Input"
if a cell on column G, in workbook B has content, this content will be shown in Column B in workbook "Input"
if a cell on column G, in workbook C has content, this content will be shown in Column C in workbook Input

then, I will have empty cells in column A, B and C on workbook "Input" and I want to delete those

did I explain myself better, this time?

many thanks in advance
BR
Paula
 
Upvote 0
Did you try the codes provided? His is more complete and ready to use as-is, but both do the exact same thing because "SpecialCells" whether done manually or by code, only takes into to account the used range of the worksheet (or in your case the used portion of columns A thru C).
 
Upvote 0
How are you populating cols A:C on the input sheet?
Formulae, macro, manual copy/paste?
 
Upvote 0
just passing through...
your code for this worked perfectly.
I can use this in my project.
Thank you
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,554
Members
448,970
Latest member
kennimack

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