Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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
listbox in excel that is an option for sql query Laoballer Excel Discussion (Misc queries) 0 September 24th 08 12:15 AM
Using a ListBox selection to query a database CLamar Excel Discussion (Misc queries) 1 June 1st 06 07:32 PM
Listbox Query Again Greg B Excel Discussion (Misc queries) 1 September 16th 05 05:01 PM
listbox query [email protected] Excel Programming 0 May 12th 05 04:47 PM
Must be better way...Using Listbox Selection to Query Data NNexcel Excel Programming 2 October 5th 04 01:25 PM


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