Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 63
Default Worksheet Change Macro Help

I need a worksheet change macro that can do the following. For cells B16,17,
18, 19, 20, 24 - 28, and 31 -34, i would like to have those cells checked for
cell lengths greater than 1024 characters. If they are over 1024 characters
display a msg box stating that. I would also like it to automatically resize
the row on which the cell is changed. I can do this outside of a worksheet
change, but I would really like this to be automatically done for the user
when they change one of the cells listed above. Any help is greatly
appreciated.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Worksheet Change Macro Help

I think this might do it for you, I haven't actually tested it, but it looks
right.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 2 Or Target.Cells.Count 1 Or _
Target.Row < 16 Or Target.Row 34 Then
'not in column B, or more than one cell changed
'or above/below rows we're interested in
Exit Sub ' not in column B
End If
Select Case Target.Row
Case Is = 16, 18, 19, 20, 24, 25, 26, 27, 28, 31, 32, 33, 34
If Len(Target.Text) 1024 Then
MsgBox "Text length is greater than 1024 characters.", _
vbOKOnly, "Cell: " & Target.Address
Exit Sub
End If
Target.Rows.AutoFit
Case Else
'all other rows ignored
End If
End Sub


"Vick" wrote:

I need a worksheet change macro that can do the following. For cells B16,17,
18, 19, 20, 24 - 28, and 31 -34, i would like to have those cells checked for
cell lengths greater than 1024 characters. If they are over 1024 characters
display a msg box stating that. I would also like it to automatically resize
the row on which the cell is changed. I can do this outside of a worksheet
change, but I would really like this to be automatically done for the user
when they change one of the cells listed above. Any help is greatly
appreciated.

Thanks

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
Worksheet change macro for paste special Phil Excel Discussion (Misc queries) 4 November 14th 08 05:42 PM
Worksheet change Macro Question Vick Excel Discussion (Misc queries) 11 January 30th 08 03:09 PM
Worksheet change Macro part 2 Vick Excel Discussion (Misc queries) 0 January 29th 08 07:36 PM
Running of Worksheet Change Macro breaks undo functionality. Rob Manger Excel Discussion (Misc queries) 1 April 6th 06 04:04 AM
Using this Automatic Resizing Macro with Worksheet Change [email protected] Excel Discussion (Misc queries) 0 December 19th 05 03:57 PM


All times are GMT +1. The time now is 04:49 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"