ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find value and delete cell and the cell next to it (https://www.excelbanter.com/excel-programming/349142-find-value-delete-cell-cell-next.html)

Pierre via OfficeKB.com[_2_]

find value and delete cell and the cell next to it
 
Hi experts,

i have a combobox on a userform. The user selects a value.
Then i have to lookup the value in a range (zoekrange) and delete the cell
containing the value and the cell next to it. I tried resizing the zoekrange
but it did not work.
Here's my code so far...

Private Sub but_verwijder_Click()
Dim zoekrange As Range
Application.ScreenUpdating = False
Sheets("hulpblad").Select
Set zoekrange = Range("b2:c500").Find(cbo_accountnr.Value)
zoekrange.Resize(0, 1).Delete shift:=xlShiftUp
MsgBox "done"
Sheets("nieuwe productie 2006").Select
Application.ScreenUpdating = True
Unload Me
End Sub

any ideas please ?
thanks,
Pierre

--
Message posted via http://www.officekb.com

Toppers

find value and delete cell and the cell next to it
 
Try

zoekrange.Resize(1, 2).Delete shift:=xlShiftUp

"Pierre via OfficeKB.com" wrote:

Hi experts,

i have a combobox on a userform. The user selects a value.
Then i have to lookup the value in a range (zoekrange) and delete the cell
containing the value and the cell next to it. I tried resizing the zoekrange
but it did not work.
Here's my code so far...

Private Sub but_verwijder_Click()
Dim zoekrange As Range
Application.ScreenUpdating = False
Sheets("hulpblad").Select
Set zoekrange = Range("b2:c500").Find(cbo_accountnr.Value)
zoekrange.Resize(0, 1).Delete shift:=xlShiftUp
MsgBox "done"
Sheets("nieuwe productie 2006").Select
Application.ScreenUpdating = True
Unload Me
End Sub

any ideas please ?
thanks,
Pierre

--
Message posted via http://www.officekb.com


Pierre via OfficeKB.com[_2_]

find value and delete cell and the cell next to it
 
Thanks Topper, this works fine !
Pierre

Toppers wrote:
Try

zoekrange.Resize(1, 2).Delete shift:=xlShiftUp

Hi experts,

[quoted text clipped - 19 lines]
thanks,
Pierre


--
Message posted via http://www.officekb.com


All times are GMT +1. The time now is 07:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com