Move cell content into another cell

projectile

Board Regular
Joined
Dec 14, 2007
Messages
193
Hi

Looking for VB code that will move the content from column H based current row selected by user.

e.g.

if user selects any cell , the VB code needs grab the content of column "H" of that row, and move it to the column "A" of the same row.

I have tried ActiveCell.Offset(0, 5).Copy , but it is picking up reletive column and but i need the fixed column reference.

thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
What kind of code are you looking for
-- Worksheet events (like changing Selection or Changing Cell content etc.) which will be triggered if you do the specified action.
Or
--Typical macro which you can call by Macro Dialog box!
 
Upvote 0
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
If Target.Count = 1 Then
    Cells(Target.Row, 8).Cut Cells(Target.Row, 1)
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
I'm trying to create a button, so when the user selects a cell, and clicks the button it performs the actions.

When I use this code above it throws an error

Sub Back2Back()

Application.EnableEvents = False
If Target.Count = 1 Then
Cells(Target.Row, 4).Cut Cells(Target.Row, 22)
End If
Application.EnableEvents = True


End Sub
 
Upvote 0
this code works

HTML:
Sub nameofRoutine()

Dim myRange As Variant

Set myRange = ActiveCell

Application.EnableEvents = False
If myRange.Count = 1 Then
    Cells(myRange.Row, 4).Cut Cells(myRange.Row, 22)
End If
Application.EnableEvents = True


End Sub


Thanks guys
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,710
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top