LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default If row 2

The code I have (below) does what I want it to do--searches for the cell that
has more than 255 characters, then cuts and pastes that row to the top of the
spreadsheet (row 2). But it throws an error when it finds the cell in row 2
and tries to cut and insert itself.

I want to put in a condition to test if row 2 (because no action is needed),
but I can't figure out how to do it. Can anyone help?

Private Sub FindMemoRow()
Dim Lcell As Range
For Each Lcell In Range("L:L")
' Looking for a cell with more than 255 characters
If Len(Lcell) 255 Then
Range(Lcell.Address).Select
Selection.EntireRow.Select
Selection.Cut
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Exit Sub
End If
Next Lcell
End Sub

Thank you,
Judy
 
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



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