ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listbox Problem (https://www.excelbanter.com/excel-programming/337912-listbox-problem.html)

browie

Listbox Problem
 
I have a list box which I have set up which runs a message bank. I would
like it to have the ability to delete the sected message from the worksheet.
How can I do this?

userform name is "splash"

listbox1 its rowsource is messagesa2:a1000
and the button i wish to use to delete is commandbutton2

any help with the code would be great

Thanks

Greg



Bob Phillips[_6_]

Listbox Problem
 
Private Sub CommandButton2_Click()
Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


--

HTH

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


"browie" wrote in message
...
I have a list box which I have set up which runs a message bank. I would
like it to have the ability to delete the sected message from the

worksheet.
How can I do this?

userform name is "splash"

listbox1 its rowsource is messagesa2:a1000
and the button i wish to use to delete is commandbutton2

any help with the code would be great

Thanks

Greg





browie

Listbox Problem
 
Thanks will try it now

Greg
"Bob Phillips" wrote in message
...
Private Sub CommandButton2_Click()
Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


--

HTH

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


"browie" wrote in message
...
I have a list box which I have set up which runs a message bank. I would
like it to have the ability to delete the sected message from the

worksheet.
How can I do this?

userform name is "splash"

listbox1 its rowsource is messagesa2:a1000
and the button i wish to use to delete is commandbutton2

any help with the code would be great

Thanks

Greg







browie

Listbox Problem
 
Bob

How can it be changed to delete the whole row.
sorry I just noticed I wrote it as a1:a1000 where it should be e1000

Private Sub CommandButton2_Click()
Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


Thanks in advance
Greg
"browie" wrote in message
...
Thanks will try it now

Greg
"Bob Phillips" wrote in message
...
Private Sub CommandButton2_Click()
Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


--

HTH

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


"browie" wrote in message
...
I have a list box which I have set up which runs a message bank. I
would
like it to have the ability to delete the sected message from the

worksheet.
How can I do this?

userform name is "splash"

listbox1 its rowsource is messagesa2:a1000
and the button i wish to use to delete is commandbutton2

any help with the code would be great

Thanks

Greg









Bob Phillips[_6_]

Listbox Problem
 
Private Sub CommandButton2_Click()

Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Entirerow.Dele
te
End Sub


--

HTH

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


"browie" wrote in message
...
Bob

How can it be changed to delete the whole row.
sorry I just noticed I wrote it as a1:a1000 where it should be e1000

Private Sub CommandButton2_Click()
Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


Thanks in advance
Greg
"browie" wrote in message
...
Thanks will try it now

Greg
"Bob Phillips" wrote in message
...
Private Sub CommandButton2_Click()
Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


--

HTH

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


"browie" wrote in message
...
I have a list box which I have set up which runs a message bank. I
would
like it to have the ability to delete the sected message from the
worksheet.
How can I do this?

userform name is "splash"

listbox1 its rowsource is messagesa2:a1000
and the button i wish to use to delete is commandbutton2

any help with the code would be great

Thanks

Greg











browie

Listbox Problem
 
Thanks Bob works Great

Greg
"Bob Phillips" wrote in message
...
Private Sub CommandButton2_Click()

Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Entirerow.Dele
te
End Sub


--

HTH

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


"browie" wrote in message
...
Bob

How can it be changed to delete the whole row.
sorry I just noticed I wrote it as a1:a1000 where it should be e1000

Private Sub CommandButton2_Click()
Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


Thanks in advance
Greg
"browie" wrote in message
...
Thanks will try it now

Greg
"Bob Phillips" wrote in message
...
Private Sub CommandButton2_Click()

Worksheets("Messages").Range("A2").Offset(ListBox1 .ListIndex).Delete
End Sub


--

HTH

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


"browie" wrote in message
...
I have a list box which I have set up which runs a message bank. I
would
like it to have the ability to delete the sected message from the
worksheet.
How can I do this?

userform name is "splash"

listbox1 its rowsource is messagesa2:a1000
and the button i wish to use to delete is commandbutton2

any help with the code would be great

Thanks

Greg














All times are GMT +1. The time now is 02:43 AM.

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