ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data Move (https://www.excelbanter.com/excel-programming/363335-data-move.html)

bodhisatvaofboogie

Data Move
 
I have gropus of data that are imported.

Heading
Phone #
Part Name & #
etc
etc

Heading
Phone #
Part Name & #
etc
etc

Heading
Phone #
Part Name & #
etc
etc

Pattern continues for over 100 pages.
Now I want the cell "Part Name & #" to be selected and moved up to an empty
cell to the right of the cell "Heading". What from a code standpoint would
that look like in Visual Basic within a macro? I want ALL of the groupings
done in this way. They are all imported in the same patterns, so if there is
some way to select all cells with "Part Name & #" have them move up two
spaces and over 5 or 6 cells then paste, that would work. Make sense???

THANKS!!!!

JackL

Data Move
 
Hi,
If I understand your question correctly, this should work. Set the range as
required.
Regards.

Sub Test()
Dim x As Variant
Dim y As Variant
For Each c In Range("A1:A20")
If c.Value = "Heading" Then
x = c.Cells.Row
y = c.Cells.Column
Cells(x, y + 1) = Cells(x + 2, y)
End If
Next
End Sub


"bodhisatvaofboogie" wrote:

I have gropus of data that are imported.

Heading
Phone #
Part Name & #
etc
etc

Heading
Phone #
Part Name & #
etc
etc

Heading
Phone #
Part Name & #
etc
etc

Pattern continues for over 100 pages.
Now I want the cell "Part Name & #" to be selected and moved up to an empty
cell to the right of the cell "Heading". What from a code standpoint would
that look like in Visual Basic within a macro? I want ALL of the groupings
done in this way. They are all imported in the same patterns, so if there is
some way to select all cells with "Part Name & #" have them move up two
spaces and over 5 or 6 cells then paste, that would work. Make sense???

THANKS!!!!



All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com