Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help Please!


I've got a list of addresses in Excel spread over 5 columns (Address
Line 1, Address Line 2 and so on). Obviously not all addresses contain
data in all 5 columns, some may have it in A,B and E others in A,D and E
etc

What I need to do is shift all the data for these addresses across to
the left with any blank columns left at the end. So for example an
address comprising 3 elements will take up columns A,B+C with D+E
blank.

I'm after some VB code I can use to automate this task for me ( I need
to run this every week for hundreds of addresses). I've tried to record
a macro using nested if statements to test cells for being blank etc but
cant get it working due to what I can only assume is complete
incompetence on my part:

If anyone can help out would be much appreciated!


--
mr starface
------------------------------------------------------------------------
mr starface's Profile: http://www.excelforum.com/member.php...o&userid=30520
View this thread: http://www.excelforum.com/showthread...hreadid=502111

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help Please!

If the cells are truly blank, you should only need:

Sub FixDate()
Columns(1).Resize(,5).SpecialCells( _
xlBlanks).Delete shift:=xlShiftToLeft
End Sub

--
Regards,
Tom Ogilvy


"mr starface"
wrote in message
...

I've got a list of addresses in Excel spread over 5 columns (Address
Line 1, Address Line 2 and so on). Obviously not all addresses contain
data in all 5 columns, some may have it in A,B and E others in A,D and E
etc

What I need to do is shift all the data for these addresses across to
the left with any blank columns left at the end. So for example an
address comprising 3 elements will take up columns A,B+C with D+E
blank.

I'm after some VB code I can use to automate this task for me ( I need
to run this every week for hundreds of addresses). I've tried to record
a macro using nested if statements to test cells for being blank etc but
cant get it working due to what I can only assume is complete
incompetence on my part:

If anyone can help out would be much appreciated!


--
mr starface
------------------------------------------------------------------------
mr starface's Profile:

http://www.excelforum.com/member.php...o&userid=30520
View this thread: http://www.excelforum.com/showthread...hreadid=502111



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



All times are GMT +1. The time now is 01:54 PM.

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

About Us

"It's about Microsoft Excel"