Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default help with VB/Macro to shift cells

Hello -
I have a basic spreadsheet with the following information. Cells
A2:A11 contain basic number valus. Cell A1 is blank.

What I would like to accomplish is for a user to enter a value into
cell A1 and have that information replace the value in A2 and shift the
rest of the values in the column down. I only want to store 10 numbers
(ie A2:A11) at a time.

Can anyone provide me with the knowledge on how to accomplish this?

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default help with VB/Macro to shift cells

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "A1"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Range("A2:A10").Copy Range("A3:A11")
Range("A2").Value = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

wrote in message
oups.com...
Hello -
I have a basic spreadsheet with the following information. Cells
A2:A11 contain basic number valus. Cell A1 is blank.

What I would like to accomplish is for a user to enter a value into
cell A1 and have that information replace the value in A2 and shift the
rest of the values in the column down. I only want to store 10 numbers
(ie A2:A11) at a time.

Can anyone provide me with the knowledge on how to accomplish this?

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.misc
mrice
 
Posts: n/a
Default help with VB/Macro to shift cells


Dan

Try the attached.

It's a short macro linked to the worksheet change event.


+-------------------------------------------------------------------+
|Filename: Book1.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4725 |
+-------------------------------------------------------------------+

--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=538587

  #4   Report Post  
Posted to microsoft.public.excel.misc
dan
 
Posts: n/a
Default help with VB/Macro to shift cells

This is perfect! Thanks so much.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
Delete - Shift Cells UP problem Ralph Excel Discussion (Misc queries) 3 March 22nd 05 11:19 PM
Help adding text values Texas-DC_271 Excel Worksheet Functions 7 January 15th 05 11:14 PM
I need to shift cells down only to a point w/o disturbing the bot. wade2753 Excel Discussion (Misc queries) 2 January 14th 05 04:35 PM
Convert data type of cells to Text,Number,Date and Time Kevin Excel Worksheet Functions 1 December 31st 04 12:57 PM


All times are GMT +1. The time now is 04:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"