Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default to delete row from userform

I have userform with one combobox which contain products name stored in
cells a2:a50(named My List) when I choose one Macro delete row where
product name is. I want to have one command button on userform which do
this. What I need to change in this code:

Option Explicit
Public Cleared As Boolean

Private Sub ComboBox1_Change()
Dim i As Integer
If Not Cleared Then
With Sheets(1)
i = Application.Match(Me.ComboBox1.Value, Range("MyList"), 0)
Cleared = True
.Range("MyList")(i).EntireRow.Delete Shift:=xlUp

End With
End If
Cleared = False
Me.Hide
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default to delete row from userform

Change this

.Range("MyList")(i).EntireRow.Delete Shift:=xlUp

to

.Range("MyList").Cells(i,1).EntireRow.Delete Shift:=xlUp

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alen32" wrote in message
lkaboutsoftware.com...
I have userform with one combobox which contain products name stored in
cells a2:a50(named My List) when I choose one Macro delete row where
product name is. I want to have one command button on userform which do
this. What I need to change in this code:

Option Explicit
Public Cleared As Boolean

Private Sub ComboBox1_Change()
Dim i As Integer
If Not Cleared Then
With Sheets(1)
i = Application.Match(Me.ComboBox1.Value, Range("MyList"), 0)
Cleared = True
.Range("MyList")(i).EntireRow.Delete Shift:=xlUp

End With
End If
Cleared = False
Me.Hide
End Sub





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
How can I delete row from userform? Alen32 Excel Programming 2 March 6th 05 11:04 PM
delete Userform control programmatically ben Excel Programming 8 February 15th 05 08:14 PM
userform delete sheet dok112[_16_] Excel Programming 0 June 22nd 04 04:45 PM
userform delete sheet dok112[_14_] Excel Programming 2 June 22nd 04 05:26 AM
Delete userform/module using VB Rohit Thomas Excel Programming 5 July 16th 03 11:01 PM


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