ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to move selected cell contents to a specific column on same row (https://www.excelbanter.com/excel-programming/290927-macro-move-selected-cell-contents-specific-column-same-row.html)

Ben Johnson[_3_]

Macro to move selected cell contents to a specific column on same row
 
Hello,

I am trying to write a macro to move data from one cell to a specific
column on the same row.

I have a data table like this:

A B C D E F
1 EMPLID Name Recommended Reserve Hover Not_Competetive
2 8163249 Bloggs
3 8894890 Jones
4 8293943 Smith


The order of names is important, and the EMPID needs to stay in column
A while the name needs to be able to be moved between columns
C,D,E,etc when you press an appropriate toolbar button.

eg.

A B C D E F
1 EMPLID Name Recommended Reserve Hover Not_Competetive
2 8163249 Bloggs
3 8894890 Jones
4 8293943 Smith


I need the flexibility of later on saying, "now I want Smith to move
to the Reserve column". I thought I could use the offset function to
select column A + 3 and past the data in there but I couldnt work out
how to make the offset always reference column A

Thanks,

Ben

Bob Phillips[_6_]

Macro to move selected cell contents to a specific column on same row
 
Ben,

Why do you need to reference column A. For instance, this macro will move
column B to C

Sub MoveToC()
With ActiveCell
.Cut Destination:=.Offset(0, 1)
End With
End Sub


This will move it to D

Sub MoveToD()
With ActiveCell
.Cut Destination:=.Offset(0, 2)
End With
End Sub

etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ben Johnson" wrote in message
om...
Hello,

I am trying to write a macro to move data from one cell to a specific
column on the same row.

I have a data table like this:

A B C D E F
1 EMPLID Name Recommended Reserve Hover Not_Competetive
2 8163249 Bloggs
3 8894890 Jones
4 8293943 Smith


The order of names is important, and the EMPID needs to stay in column
A while the name needs to be able to be moved between columns
C,D,E,etc when you press an appropriate toolbar button.

eg.

A B C D E F
1 EMPLID Name Recommended Reserve Hover Not_Competetive
2 8163249 Bloggs
3 8894890 Jones
4 8293943 Smith


I need the flexibility of later on saying, "now I want Smith to move
to the Reserve column". I thought I could use the offset function to
select column A + 3 and past the data in there but I couldnt work out
how to make the offset always reference column A

Thanks,

Ben





All times are GMT +1. The time now is 10:38 AM.

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