Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default MORE listbox code

In a listbox that allows multi selections and has multi columns when the user
makes his selections how do you place text such as "PAID" in column F for the
corresponding rows selected on the database worksheet. Note: this worksheet
is the same info filling the list box. Thank you Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default MORE listbox code

Assume you ListFillRange holds a string like

Data!B9:E35
(Includes the sheet name)


Set sh = Worksheets("Data")
set rng = Range(Listbox1.ListFillRange).Columns(1).Cells

for i = 0 to listbox1.Listcount - 1
if listbox1.Selected(i) then
rw = rng(i+1).row
sh.cells(rw,"F").Value = "Paid"
end if
Next

--
regards,
Tom Ogilvy




"Jennifer" wrote:

In a listbox that allows multi selections and has multi columns when the user
makes his selections how do you place text such as "PAID" in column F for the
corresponding rows selected on the database worksheet. Note: this worksheet
is the same info filling the list box. Thank you Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default MORE listbox code

You lost me Tom on the ListFillRange
this is the code so far that i have adapted from yours . . .
ha I changed 1 thing Ha Ha!
I'm guessing that the ListFillRange has something to do w/the named range
("Database") on the worksheet ("ProduceData")

So right now I'm getting an error saying that the listfillrange is not
defined?

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = Range(lstData.ListFillRange).Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next
--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

Assume you ListFillRange holds a string like

Data!B9:E35
(Includes the sheet name)


Set sh = Worksheets("Data")
set rng = Range(Listbox1.ListFillRange).Columns(1).Cells

for i = 0 to listbox1.Listcount - 1
if listbox1.Selected(i) then
rw = rng(i+1).row
sh.cells(rw,"F").Value = "Paid"
end if
Next

--
regards,
Tom Ogilvy




"Jennifer" wrote:

In a listbox that allows multi selections and has multi columns when the user
makes his selections how do you place text such as "PAID" in column F for the
corresponding rows selected on the database worksheet. Note: this worksheet
is the same info filling the list box. Thank you Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default MORE listbox code

assuming a workbook level Name

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = sh.Range("Database").Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next

assume a sheet level name

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = sh.Range("ProduceData!Database").Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next

--
Regards,
Tom Ogilvy


"Jennifer" wrote:

You lost me Tom on the ListFillRange
this is the code so far that i have adapted from yours . . .
ha I changed 1 thing Ha Ha!
I'm guessing that the ListFillRange has something to do w/the named range
("Database") on the worksheet ("ProduceData")

So right now I'm getting an error saying that the listfillrange is not
defined?

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = Range(lstData.ListFillRange).Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next
--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

Assume you ListFillRange holds a string like

Data!B9:E35
(Includes the sheet name)


Set sh = Worksheets("Data")
set rng = Range(Listbox1.ListFillRange).Columns(1).Cells

for i = 0 to listbox1.Listcount - 1
if listbox1.Selected(i) then
rw = rng(i+1).row
sh.cells(rw,"F").Value = "Paid"
end if
Next

--
regards,
Tom Ogilvy




"Jennifer" wrote:

In a listbox that allows multi selections and has multi columns when the user
makes his selections how do you place text such as "PAID" in column F for the
corresponding rows selected on the database worksheet. Note: this worksheet
is the same info filling the list box. Thank you Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default MORE listbox code

Getting closer but we are still having troubles, it is placing a singe "Paid"
in column "AG" but there doesn't seem to be a real reason for the placement.
Hmmm!

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Dim rng As Range
Set rng = sh.Range("Database").Columns(1).Cells
Dim i As Long
Dim rw As Long

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next


--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

assuming a workbook level Name

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = sh.Range("Database").Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next

assume a sheet level name

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = sh.Range("ProduceData!Database").Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next

--
Regards,
Tom Ogilvy


"Jennifer" wrote:

You lost me Tom on the ListFillRange
this is the code so far that i have adapted from yours . . .
ha I changed 1 thing Ha Ha!
I'm guessing that the ListFillRange has something to do w/the named range
("Database") on the worksheet ("ProduceData")

So right now I'm getting an error saying that the listfillrange is not
defined?

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = Range(lstData.ListFillRange).Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next
--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

Assume you ListFillRange holds a string like

Data!B9:E35
(Includes the sheet name)


Set sh = Worksheets("Data")
set rng = Range(Listbox1.ListFillRange).Columns(1).Cells

for i = 0 to listbox1.Listcount - 1
if listbox1.Selected(i) then
rw = rng(i+1).row
sh.cells(rw,"F").Value = "Paid"
end if
Next

--
regards,
Tom Ogilvy




"Jennifer" wrote:

In a listbox that allows multi selections and has multi columns when the user
makes his selections how do you place text such as "PAID" in column F for the
corresponding rows selected on the database worksheet. Note: this worksheet
is the same info filling the list box. Thank you Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default MORE listbox code

If the entries in your listbox correspond to the rows of the range Database,
then it should do what you want.

If that is not case, then you would have to search the range database to
find the matching row and place it there.

--
Regards,
Tom Ogilvy

"Jennifer" wrote in message
...
Getting closer but we are still having troubles, it is placing a singe

"Paid"
in column "AG" but there doesn't seem to be a real reason for the

placement.
Hmmm!

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Dim rng As Range
Set rng = sh.Range("Database").Columns(1).Cells
Dim i As Long
Dim rw As Long

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next


--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

assuming a workbook level Name

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = sh.Range("Database").Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next

assume a sheet level name

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = sh.Range("ProduceData!Database").Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next

--
Regards,
Tom Ogilvy


"Jennifer" wrote:

You lost me Tom on the ListFillRange
this is the code so far that i have adapted from yours . . .
ha I changed 1 thing Ha Ha!
I'm guessing that the ListFillRange has something to do w/the named

range
("Database") on the worksheet ("ProduceData")

So right now I'm getting an error saying that the listfillrange is not
defined?

Dim sh As Worksheet
Set sh = Worksheets("ProduceData")
Set rng = Range(lstData.ListFillRange).Columns(1).Cells

For i = 0 To lstData.ListCount - 1
If lstData.Selected(i) Then
rw = rng(i + 1).Row
sh.Cells(rw, "ag").Value = "Paid"
End If
Next
--
Though daily learning, I LOVE EXCEL!
Jennifer


"Tom Ogilvy" wrote:

Assume you ListFillRange holds a string like

Data!B9:E35
(Includes the sheet name)


Set sh = Worksheets("Data")
set rng = Range(Listbox1.ListFillRange).Columns(1).Cells

for i = 0 to listbox1.Listcount - 1
if listbox1.Selected(i) then
rw = rng(i+1).row
sh.cells(rw,"F").Value = "Paid"
end if
Next

--
regards,
Tom Ogilvy




"Jennifer" wrote:

In a listbox that allows multi selections and has multi columns

when the user
makes his selections how do you place text such as "PAID" in

column F for the
corresponding rows selected on the database worksheet. Note: this

worksheet
is the same info filling the list box. Thank you Thank you!
--
Though daily learning, I LOVE EXCEL!
Jennifer



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 code Jennifer Excel Programming 6 March 5th 07 03:14 PM
Modification of listbox to listbox code Sam S via OfficeKB.com Excel Programming 0 July 28th 05 12:02 PM
Modification of listbox to listbox code R.VENKATARAMAN Excel Programming 0 July 28th 05 05:36 AM
Listbox Propery code Mike Fogleman Excel Programming 3 January 1st 04 04:27 PM
ListBox List Code? Abdul[_4_] Excel Programming 1 October 10th 03 01:28 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"