Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default VBA Code to Automatically move text into above cells?

I have (with the help of some of the very talented Excel MVPs) nearly
finished a to do list spread sheet!

http://www.box.net/shared/ejzn141dux

The worksheet works like this:
Enter desired text in cell c3 and then use the drop down button in b3 to
determine the position where the text is to be placed in the below list. If
there is text already in that position all the text below is moved down one
cell. This part of it works fine.

Three lists can be managed this way €“ Home, Work and Other.

However, I would like to be able to delete the text from a cell by using the
backspace button. For example if I deleted the text in C9 (Go Shopping) all
the text in the cells below would be moved up one €“ie, Hoover Lounge would
move up to C9 and Pay Milkman to C10 etc. I would like to be able to do this
for all three lists €“ (which have 100 positions each as the range), but am
not sure how to adapt/add to the already existing VBA code. I have tried, but
am out of my depth.

Yours sincerely,

Matt €“ a hopefully organised infant school teacher in 2010!

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default VBA Code to Automatically move text into above cells?

with the help of some ??? Just call me "some" from now on.
Since I am the one who wrote the original code and I don't see any other
code, I will answer the follow up. I notice you were shading the text cell
which shaded the destination cell so I also fixed that.

=
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range) 'SAS
Application.ScreenUpdating = False
If Not Intersect(Target, Range("b3,g3,l3")) Is Nothing Then
If Len(Application.Trim(Target.Offset(, 1))) < 1 Then Exit Sub

With Cells(Target + 5, Target.Column + 1)
If Len(Application.Trim(.Value)) < 1 Then
.Value = Target.Offset(, 1).Value
Else
Target.Offset(, 1).Copy
.Insert Shift:=xlDown
.Offset(-1).Interior.ColorIndex = 0
End If
End With
Application.CutCopyMode = False
End If
'delete
If Not Intersect(Target, Range("c6:c45,h6:h45,m6:m45")) Is Nothing Then
Application.EnableEvents = False
If Len(Application.Trim(Target)) < 1 Then Target.Delete Shift:=xlUp
Application.EnableEvents = True
End If
Application.ScreenUpdating = True
End Sub
==


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"mj_bowen" wrote in message
...
I have (with the help of some of the very talented Excel MVPs) nearly
finished a to do list spread sheet!

http://www.box.net/shared/ejzn141dux

The worksheet works like this:
Enter desired text in cell c3 and then use the drop down button in b3 to
determine the position where the text is to be placed in the below list.
If
there is text already in that position all the text below is moved down
one
cell. This part of it works fine.

Three lists can be managed this way €“ Home, Work and Other.

However, I would like to be able to delete the text from a cell by using
the
backspace button. For example if I deleted the text in C9 (Go Shopping)
all
the text in the cells below would be moved up one €“ie, Hoover Lounge
would
move up to C9 and Pay Milkman to C10 etc. I would like to be able to do
this
for all three lists €“ (which have 100 positions each as the range), but
am
not sure how to adapt/add to the already existing VBA code. I have tried,
but
am out of my depth.

Yours sincerely,

Matt €“ a hopefully organised infant school teacher in 2010!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default VBA Code to Automatically move text into above cells?

Can we call you SUM() for short?

"Don Guillett" wrote:

with the help of some ??? Just call me "some" from now on.

Since I am the one who wrote the original code and I don't see any other
code, I will answer the follow up. I notice you were shading the text cell
which shaded the destination cell so I also fixed that.

=
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range) 'SAS
Application.ScreenUpdating = False
If Not Intersect(Target, Range("b3,g3,l3")) Is Nothing Then
If Len(Application.Trim(Target.Offset(, 1))) < 1 Then Exit Sub

With Cells(Target + 5, Target.Column + 1)
If Len(Application.Trim(.Value)) < 1 Then
.Value = Target.Offset(, 1).Value
Else
Target.Offset(, 1).Copy
.Insert Shift:=xlDown
.Offset(-1).Interior.ColorIndex = 0
End If
End With
Application.CutCopyMode = False
End If
'delete
If Not Intersect(Target, Range("c6:c45,h6:h45,m6:m45")) Is Nothing Then
Application.EnableEvents = False
If Len(Application.Trim(Target)) < 1 Then Target.Delete Shift:=xlUp
Application.EnableEvents = True
End If
Application.ScreenUpdating = True
End Sub
==


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"mj_bowen" wrote in message
...
I have (with the help of some of the very talented Excel MVP€„¢s) nearly
finished a to do list spread sheet!

http://www.box.net/shared/ejzn141dux

The worksheet works like this:
Enter desired text in cell c3 and then use the drop down button in b3 to
determine the position where the text is to be placed in the below list.
If
there is text already in that position all the text below is moved down
one
cell. This part of it works fine.

Three lists can be managed this way €€œ Home, Work and Other.

However, I would like to be able to delete the text from a cell by using
the
backspace button. For example if I deleted the text in C9 (Go Shopping)
all
the text in the cells below would be moved up one €€œie, Hoover Lounge
would
move up to C9 and Pay Milkman to C10 etc. I would like to be able to do
this
for all three lists €€œ (which have 100 positions each as the range), but
am
not sure how to adapt/add to the already existing VBA code. I have tried,
but
am out of my depth.

Yours sincerely,

Matt €€œ a hopefully organised infant school teacher in 2010!


.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default VBA Code to Automatically move text into above cells?

Thank you once again Don - Sorry about the "Some" incident, I didn't know if
it was wise to mention names as I had previously posted on another forum only
to be told off by the forum police!

It works like a charm!

Happy New Year!

Don Rules!

Matt

"Don Guillett" wrote:

with the help of some ??? Just call me "some" from now on.

Since I am the one who wrote the original code and I don't see any other
code, I will answer the follow up. I notice you were shading the text cell
which shaded the destination cell so I also fixed that.

=
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range) 'SAS
Application.ScreenUpdating = False
If Not Intersect(Target, Range("b3,g3,l3")) Is Nothing Then
If Len(Application.Trim(Target.Offset(, 1))) < 1 Then Exit Sub

With Cells(Target + 5, Target.Column + 1)
If Len(Application.Trim(.Value)) < 1 Then
.Value = Target.Offset(, 1).Value
Else
Target.Offset(, 1).Copy
.Insert Shift:=xlDown
.Offset(-1).Interior.ColorIndex = 0
End If
End With
Application.CutCopyMode = False
End If
'delete
If Not Intersect(Target, Range("c6:c45,h6:h45,m6:m45")) Is Nothing Then
Application.EnableEvents = False
If Len(Application.Trim(Target)) < 1 Then Target.Delete Shift:=xlUp
Application.EnableEvents = True
End If
Application.ScreenUpdating = True
End Sub
==


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"mj_bowen" wrote in message
...
I have (with the help of some of the very talented Excel MVP€„¢s) nearly
finished a to do list spread sheet!

http://www.box.net/shared/ejzn141dux

The worksheet works like this:
Enter desired text in cell c3 and then use the drop down button in b3 to
determine the position where the text is to be placed in the below list.
If
there is text already in that position all the text below is moved down
one
cell. This part of it works fine.

Three lists can be managed this way €€œ Home, Work and Other.

However, I would like to be able to delete the text from a cell by using
the
backspace button. For example if I deleted the text in C9 (Go Shopping)
all
the text in the cells below would be moved up one €€œie, Hoover Lounge
would
move up to C9 and Pay Milkman to C10 etc. I would like to be able to do
this
for all three lists €€œ (which have 100 positions each as the range), but
am
not sure how to adapt/add to the already existing VBA code. I have tried,
but
am out of my depth.

Yours sincerely,

Matt €€œ a hopefully organised infant school teacher in 2010!


.

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
Automatically move text from one document to another BB Excel Worksheet Functions 1 September 22nd 09 07:02 PM
move data in cells automatically Ann Excel Worksheet Functions 1 June 5th 08 03:43 PM
How do I automatically move vertical cells horizontally? Trice New Users to Excel 0 October 7th 05 04:57 PM
Paste and automatically move cells Paul (ESI) Excel Discussion (Misc queries) 4 June 30th 05 02:31 PM
How to code so cells or text automatically change color based on . lisamariehewson Excel Worksheet Functions 2 February 25th 05 10:10 PM


All times are GMT +1. The time now is 03:16 AM.

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

About Us

"It's about Microsoft Excel"