Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default How do I Delete blank cells in a row

Hi

I have a large amount of address data that ultimately I want to concatenate.
However as some addresses have more lines in than others when I concatenate
them I'm left with gaps e.g. between the name of the town and the Post code.

Example data is below

A B C
Name Line 1 Line 2 Line 3 Line 4 Acc No.
Mr Smith 2 High St. Witan Sussex EH1 6JH 1234556
Mrs Jones 1 Jump St. Hove BN1 9OL 2356852

When Concatenated the second line looks like

Mrs Jones
1 Jump St,
Hove

BN1 9OL

I can copy the address data to a different tab before applying the formula
then copy the data back so the account numbers all stay in the same column.

Thanks in advance.

Andy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 157
Default How do I Delete blank cells in a row

I'm guessing what you want to do is modify the existing data so that the Mrs
Jones' postcode moves from col E to col D. I'm also assuming the headers are
in row 1 and the data starts in row 2.

In your example, this finds the blank cell at D3, copies E3 to D3 then
deletes E3.

Sub test()
For r = 2 To 3 ' change 3 to match the last line of data in your file
For c = 2 To 4
If Cells(r, c).Value = "" Then
Cells(r, c).Value = Cells(r, c + 1).Value
Cells(r, c + 1).Value = ""
End If
Next c
Next r
End Sub



--
Ian
--
"Andy in Edinburgh" wrote in
message ...
Hi

I have a large amount of address data that ultimately I want to
concatenate.
However as some addresses have more lines in than others when I
concatenate
them I'm left with gaps e.g. between the name of the town and the Post
code.

Example data is below

A B C
Name Line 1 Line 2 Line 3 Line 4 Acc No.
Mr Smith 2 High St. Witan Sussex EH1 6JH 1234556
Mrs Jones 1 Jump St. Hove BN1 9OL 2356852

When Concatenated the second line looks like

Mrs Jones
1 Jump St,
Hove

BN1 9OL

I can copy the address data to a different tab before applying the formula
then copy the data back so the account numbers all stay in the same
column.

Thanks in advance.

Andy



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,081
Default How do I Delete blank cells in a row

select the entire range
press the F5 key, click on Special
Select blanks and click on OK

Now use Edit-Delete-Shift Left

"Andy in Edinburgh" wrote:

Hi

I have a large amount of address data that ultimately I want to concatenate.
However as some addresses have more lines in than others when I concatenate
them I'm left with gaps e.g. between the name of the town and the Post code.

Example data is below

A B C
Name Line 1 Line 2 Line 3 Line 4 Acc No.
Mr Smith 2 High St. Witan Sussex EH1 6JH 1234556
Mrs Jones 1 Jump St. Hove BN1 9OL 2356852

When Concatenated the second line looks like

Mrs Jones
1 Jump St,
Hove

BN1 9OL

I can copy the address data to a different tab before applying the formula
then copy the data back so the account numbers all stay in the same column.

Thanks in advance.

Andy

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 157
Default How do I Delete blank cells in a row

Hi Duke

The problem with this is that the account numbers will shift to the left.
The OP wanted the account numbers to be undisturbed.

Andy would need to copy the address data to another sheet and apply your fix
there before copying the revised data back.

--
Ian
--
"Duke Carey" wrote in message
...
select the entire range
press the F5 key, click on Special
Select blanks and click on OK

Now use Edit-Delete-Shift Left

"Andy in Edinburgh" wrote:

Hi

I have a large amount of address data that ultimately I want to
concatenate.
However as some addresses have more lines in than others when I
concatenate
them I'm left with gaps e.g. between the name of the town and the Post
code.

Example data is below

A B C
Name Line 1 Line 2 Line 3 Line 4 Acc No.
Mr Smith 2 High St. Witan Sussex EH1 6JH 1234556
Mrs Jones 1 Jump St. Hove BN1 9OL 2356852

When Concatenated the second line looks like

Mrs Jones
1 Jump St,
Hove

BN1 9OL

I can copy the address data to a different tab before applying the
formula
then copy the data back so the account numbers all stay in the same
column.

Thanks in advance.

Andy



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete error/blank cells Ask MS[_2_] Excel Worksheet Functions 3 June 30th 08 01:54 PM
Delete row if all cells are blank, Excel 2000 & 2003 [email protected] Excel Discussion (Misc queries) 1 December 14th 07 03:55 PM
Using a function to delete blank cells Carter Devereaux Excel Worksheet Functions 2 September 1st 07 03:40 PM
Easiest way to delete blank cells in column (not entire row) sramsey Excel Discussion (Misc queries) 4 February 16th 06 04:28 PM
Macro to Delete blank cells GarToms Excel Worksheet Functions 1 January 26th 06 07:39 PM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"