ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listbox query (https://www.excelbanter.com/excel-programming/339051-listbox-query.html)

Greg B[_5_]

Listbox query
 
Hi all how can I change the code below to copy the selected line from the
listbox and copy it to a sheet called popup. The code I received from
someone before workgreat in removing a message from another userform but I
would like to change it a little.



Private Sub CommandButton2_Click()

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



End Sub


Thanks again

Greg





Dave Peterson

Listbox query
 
Maybe...

Private Sub CommandButton2_Click()

dim destCell as range

with worksheets("Popup")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with listbox1
if .listindex -1 then
destcell.value = .list(.listindex)
end if
end with

end sub

Greg B wrote:

Hi all how can I change the code below to copy the selected line from the
listbox and copy it to a sheet called popup. The code I received from
someone before workgreat in removing a message from another userform but I
would like to change it a little.

Private Sub CommandButton2_Click()

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

End Sub

Thanks again

Greg


--

Dave Peterson

Greg B[_5_]

Listbox query
 
Thanks Dave will give it a go

Greg
"Dave Peterson" wrote in message
...
Maybe...

Private Sub CommandButton2_Click()

dim destCell as range

with worksheets("Popup")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with listbox1
if .listindex -1 then
destcell.value = .list(.listindex)
end if
end with

end sub

Greg B wrote:

Hi all how can I change the code below to copy the selected line from

the
listbox and copy it to a sheet called popup. The code I received from
someone before workgreat in removing a message from another userform but

I
would like to change it a little.

Private Sub CommandButton2_Click()


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

End Sub

Thanks again

Greg


--

Dave Peterson




Greg B[_5_]

Listbox query
 
Just a little bit more on that, Sorry I didn't explain too well, I need it
to copy the whole line. The listbox's rowsource is a2:e65536

Thanks again

Greg
"Greg B" wrote in message
...
Thanks Dave will give it a go

Greg
"Dave Peterson" wrote in message
...
Maybe...

Private Sub CommandButton2_Click()

dim destCell as range

with worksheets("Popup")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with listbox1
if .listindex -1 then
destcell.value = .list(.listindex)
end if
end with

end sub

Greg B wrote:

Hi all how can I change the code below to copy the selected line from

the
listbox and copy it to a sheet called popup. The code I received from
someone before workgreat in removing a message from another userform

but
I
would like to change it a little.

Private Sub CommandButton2_Click()



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

End Sub

Thanks again

Greg


--

Dave Peterson






Dave Peterson

Listbox query
 
You have a followup to your other post.

Greg B wrote:

Just a little bit more on that, Sorry I didn't explain too well, I need it
to copy the whole line. The listbox's rowsource is a2:e65536

Thanks again

Greg
"Greg B" wrote in message
...
Thanks Dave will give it a go

Greg
"Dave Peterson" wrote in message
...
Maybe...

Private Sub CommandButton2_Click()

dim destCell as range

with worksheets("Popup")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with listbox1
if .listindex -1 then
destcell.value = .list(.listindex)
end if
end with

end sub

Greg B wrote:

Hi all how can I change the code below to copy the selected line from

the
listbox and copy it to a sheet called popup. The code I received from
someone before workgreat in removing a message from another userform

but
I
would like to change it a little.

Private Sub CommandButton2_Click()



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

End Sub

Thanks again

Greg

--

Dave Peterson




--

Dave Peterson


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

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