Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to move data to new column

I tried that and it dint' work.

I have data in column a (names)

in columb B are addresses, suites, and citySTzip

I need the suite to move from B2 to C1 and the CityState to move from B3 to D1

I need to be able to do this continually and so on.

Thank you. I'm not all that familiar with the macros so if you know the
code and should I put it in the immediate window in Visual Basic or open up a
module I would need to know that too.

Thanks much.

"WannabeExcelQueen" wrote:

I have data that needs to be moved from column B to C and D

Basically it's set up like below, and I need cell B2 to move to C1, and B3
to move to D1 and so on. There is a space in between sets like this and some
of them have a suite and some do not. So some sets are 4 rows then a blank
space, and some are 3 rows then a blank space.

A B C D
1 First M. Last 123 Street Name
2 Suite 123
3 City, State Zip
4
5 First M. Last 123 Street Name
6 City, State Zip
7
8


What I need is for the Suite to go to C and the CityStateZip to go to D
automatically.

Is there a code or macro I can use to do this without having to move each
row and then delete all the blanks?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default macro to move data to new column

Put this in a module:

Sub moveData()
Dim i As Range, lRow As Long, rng As Range
lRow = Range("B65536").End(xlUp).Row
Set rng = Range(Cells(1, 1), Cells(lRow, 1))
For Each i In rng
If i.Value < "" Then
If Left(i.Offset(1, 1).Value, 5) = "Suite" Then
i.Offset(1, 1).Cut i.Offset(, 2)
i.Offset(2, 1).Cut i.Offset(, 3)
i.Offset(1, 0).EntireRow.Delete
i.Offset(2, 0).EntireRow.Delete
Else
i.Offset(1, 1).Cut i.Offset(, 3)
i.Offset(1, 0).EntireRow.Delete
End If
End If
Next i
End Sub

--
Dan

On Dec 14, 8:53 am, WannabeExcelQueen
wrote:
I tried that and it dint' work.

I have data in column a (names)

in columb B are addresses, suites, and citySTzip

I need the suite to move from B2 to C1 and the CityState to move from B3 to D1

I need to be able to do this continually and so on.

Thank you. I'm not all that familiar with the macros so if you know the
code and should I put it in the immediate window in Visual Basic or open up a
module I would need to know that too.

Thanks much.



"WannabeExcelQueen" wrote:
I have data that needs to be moved from column B to C and D


Basically it's set up like below, and I need cell B2 to move to C1, and B3
to move to D1 and so on. There is a space in between sets like this and some
of them have a suite and some do not. So some sets are 4 rows then a blank
space, and some are 3 rows then a blank space.


A B C D
1 First M. Last 123 Street Name
2 Suite 123
3 City, State Zip
4
5 First M. Last 123 Street Name
6 City, State Zip
7
8


What I need is for the Suite to go to C and the CityStateZip to go to D
automatically.


Is there a code or macro I can use to do this without having to move each
row and then delete all the blanks?- Hide quoted text -


- Show quoted text -


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
macro to move to minimum value in column of data g_noggle Excel Discussion (Misc queries) 2 November 8th 07 02:32 PM
how to move the cursor to column A after entering data column F tskaiser New Users to Excel 2 April 29th 06 02:28 PM
Macro to move data to different column based on data in another co malycom Excel Discussion (Misc queries) 3 August 2nd 05 07:07 PM
create macro to move label type data to column data JonathonWood9 Excel Programming 4 February 21st 05 10:53 PM
Need a macro to move data from column into rows floss Excel Programming 4 June 5th 04 06:06 AM


All times are GMT +1. The time now is 12:33 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"