Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Selecting a small range of cells to delete

This is a portion of code where I am using a listbox selection to find a
person in a list. The last line here is where I keep getting stuck. After I
find the person and move to the right, I want to select the cell I am on plus
two cells to the right so I can delete them. I've looked up as much as I can
in help and examples here but nothing seems to work for me. Can anyone assist?



Private Sub CommandButton3_Click()
Dim Remove As Object

'Remove on Employee Training Sheet

Set Remove = Worksheets("Keys").Range("L19")

If Remove < "" Then
Range("L19").Select
Selection.Copy
Range("B3").Select
Cells.Find(What:=Remove, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Else
MsgBox ("No one is selected")
End If

ActiveCell.Offset(0, -1).Select
Range(ActiveCell.Offset(0, 3)).Select

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Selecting a small range of cells to delete

hi
Range(ActiveCell, ActiveCell.Offset(0, 2)).Select
Selection.Delete

but if you want to delete, rolled it up to one line. no select needed...

Range(ActiveCell, ActiveCell.Offset(0, 2)).Delete shift:=xlUp

regards
FSt1
"Carrie_Loos via OfficeKB.com" wrote:

This is a portion of code where I am using a listbox selection to find a
person in a list. The last line here is where I keep getting stuck. After I
find the person and move to the right, I want to select the cell I am on plus
two cells to the right so I can delete them. I've looked up as much as I can
in help and examples here but nothing seems to work for me. Can anyone assist?



Private Sub CommandButton3_Click()
Dim Remove As Object

'Remove on Employee Training Sheet

Set Remove = Worksheets("Keys").Range("L19")

If Remove < "" Then
Range("L19").Select
Selection.Copy
Range("B3").Select
Cells.Find(What:=Remove, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Else
MsgBox ("No one is selected")
End If

ActiveCell.Offset(0, -1).Select
Range(ActiveCell.Offset(0, 3)).Select

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Selecting a small range of cells to delete

Gosh - I knew it was just that easy. I guess I don't get the syntax of the
"double" ActiveCell. Apparently you have to reference the cell you are on
then plus more cells? Thanks so much.

FSt1 wrote:
hi
Range(ActiveCell, ActiveCell.Offset(0, 2)).Select
Selection.Delete

but if you want to delete, rolled it up to one line. no select needed...

Range(ActiveCell, ActiveCell.Offset(0, 2)).Delete shift:=xlUp

regards
FSt1

This is a portion of code where I am using a listbox selection to find a
person in a list. The last line here is where I keep getting stuck. After I

[quoted text clipped - 22 lines]
ActiveCell.Offset(0, -1).Select
Range(ActiveCell.Offset(0, 3)).Select


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Selecting a small range of cells to delete



"Carrie_Loos via OfficeKB.com" wrote:

Gosh - I knew it was just that easy. I guess I don't get the syntax of the
"double" ActiveCell. Apparently you have to reference the cell you are on
then plus more cells? Thanks so much.

FSt1 wrote:
hi
Range(ActiveCell, ActiveCell.Offset(0, 2)).Select
Selection.Delete

but if you want to delete, rolled it up to one line. no select needed...

Range(ActiveCell, ActiveCell.Offset(0, 2)).Delete shift:=xlUp

regards
FSt1

This is a portion of code where I am using a listbox selection to find a
person in a list. The last line here is where I keep getting stuck. After I

[quoted text clipped - 22 lines]
ActiveCell.Offset(0, -1).Select
Range(ActiveCell.Offset(0, 3)).Select


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1


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
Selecting a range of cells, how to ? Luc Excel Programming 1 February 23rd 07 08:04 PM
Selecting a range of cells , how to ? Luc Excel Programming 1 February 23rd 07 07:30 PM
Selecting a range of cells, how to ? Luc Excel Worksheet Functions 2 February 23rd 07 07:17 PM
Delete cells without selecting? Rob van Gelder[_4_] Excel Programming 1 January 20th 05 02:07 AM
Selecting a Range of cells in VBA spacecityguy[_4_] Excel Programming 3 August 30th 04 04:14 PM


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