ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Multiple cells to one (https://www.excelbanter.com/excel-discussion-misc-queries/91021-multiple-cells-one.html)

Btobin0

Multiple cells to one
 
I am trying to get cell A1 to be A2 through A31. I want to be able to select
A3 and A1 changes to it.

KellTainer

Multiple cells to one
 

Hi

You can do this programmatically through VBA. Use this in the sheet
object that enforces this behavior.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell.column = 1 And Application.ActiveCell.row
1 And Application.ActiveCell.row < 32 Then

Application.ActiveSheet.Range("A1").Value =
Application.ActiveCell.Value
End If
End Sub


--
KellTainer
------------------------------------------------------------------------
KellTainer's Profile: http://www.excelforum.com/member.php...o&userid=34322
View this thread: http://www.excelforum.com/showthread...hreadid=546331


Btobin0

Multiple cells to one
 
That errored out. Idid get this to work.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell.Column = 1 And Application.ActiveCell.Row < 32 Then
Application.ActiveSheet.Range("A1").Value = Application.ActiveCell.Value
End If
End Sub

"KellTainer" wrote:


Hi

You can do this programmatically through VBA. Use this in the sheet
object that enforces this behavior.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell.column = 1 And Application.ActiveCell.row
1 And Application.ActiveCell.row < 32 Then

Application.ActiveSheet.Range("A1").Value =
Application.ActiveCell.Value
End If
End Sub


--
KellTainer
------------------------------------------------------------------------
KellTainer's Profile: http://www.excelforum.com/member.php...o&userid=34322
View this thread: http://www.excelforum.com/showthread...hreadid=546331



Btobin0

Multiple cells to one
 


"Btobin0" wrote:

That errored out. I did get this to work. but still did not change any values

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell.Column = 1 And Application.ActiveCell.Row < 32 Then
Application.ActiveSheet.Range("A1").Value = Application.ActiveCell.Value
End If
End Sub

"KellTainer" wrote:


Hi

You can do this programmatically through VBA. Use this in the sheet
object that enforces this behavior.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell.column = 1 And Application.ActiveCell.row
1 And Application.ActiveCell.row < 32 Then

Application.ActiveSheet.Range("A1").Value =
Application.ActiveCell.Value
End If
End Sub


--
KellTainer
------------------------------------------------------------------------
KellTainer's Profile: http://www.excelforum.com/member.php...o&userid=34322
View this thread: http://www.excelforum.com/showthread...hreadid=546331



Btobin0

Multiple cells to one
 
Sorry but I forgot to mention that A1 values did not change

"Btobin0" wrote:

That errored out. Idid get this to work.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell.Column = 1 And Application.ActiveCell.Row < 32 Then
Application.ActiveSheet.Range("A1").Value = Application.ActiveCell.Value
End If
End Sub

"KellTainer" wrote:


Hi

You can do this programmatically through VBA. Use this in the sheet
object that enforces this behavior.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ActiveCell.column = 1 And Application.ActiveCell.row
1 And Application.ActiveCell.row < 32 Then

Application.ActiveSheet.Range("A1").Value =
Application.ActiveCell.Value
End If
End Sub


--
KellTainer
------------------------------------------------------------------------
KellTainer's Profile: http://www.excelforum.com/member.php...o&userid=34322
View this thread: http://www.excelforum.com/showthread...hreadid=546331



KellTainer

Multiple cells to one
 

Thats weird. I double check the code by creating sample file and dumping
the vba back in and it does work. Send your file to my email @
and I will see what I can do.


--
KellTainer
------------------------------------------------------------------------
KellTainer's Profile:
http://www.excelforum.com/member.php...o&userid=34322
View this thread: http://www.excelforum.com/showthread...hreadid=546331


Ron Rosenfeld

Multiple cells to one
 
On Sun, 28 May 2006 16:55:02 -0700, Btobin0
wrote:

I am trying to get cell A1 to be A2 through A31. I want to be able to select
A3 and A1 changes to it.


Try this worksheet code.

To enter the code, right-click on the sheet tab and select View Code.

Then paste this code into the module that opens:

==========================
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim AOI As Range
Set AOI = [A3:A31]

If Not Intersect(Target, AOI) Is Nothing Then
[a1].Value = Target.Value
End If

End Sub
===========================


--ron


All times are GMT +1. The time now is 07:29 PM.

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