Using the clicked on cell to put data into another cell

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I'm looking for a macro that can add the name in column C of the active cell into Sheet "Projects" range "B11"

So for example if i click on cell H27 it would use C27
but if I click on GU15 its still C15

please help if you can.

Thanks

Tony
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi Tony,

Is this active cell on multiple sheets or just one sheet? Just wondering where to put the macro (sheet or workbook).

WBD
 
Upvote 0
Hi wideboy,

It will be just one sheet call "Data" that I will be wanting it to work on
Also would be helpful if it only run when the click cell was between Column J and SA

Thanks

Tony
 
Upvote 0
OK. Right click on the "Data" tab, select "View Code..." and paste this:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Count = 1 And Target.Column >= Range("J1").Column And Target.Column <= Range("SA1").Column Then
    Sheets("Projects").Range("B11").Value = Cells(Target.Row, "C").Value
End If

End Sub

WBD
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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