Welcome to Dream.In.Code
Become a VB Expert!

Join 149,970 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,388 people online right now. Registration is fast and FREE... Join Now!




I need to designate a column for List Box

 
Reply to this topicStart new topic

I need to designate a column for List Box

Boomerj
19 Jan, 2008 - 04:02 PM
Post #1

New D.I.C Head
*

Joined: 19 Jan, 2008
Posts: 1

This code brings a listbox up on a spreadsheet so you can line items from a list.....it then drops those items into a column on the spreadsheet.....I can't figure out how to designate a column! The first row is 13, but it always drops in column"A" row "13", I need it to start in column "B" row "13".......How do I designate a column?



CODE

Sub CommandButton2_Click()
    DialogSheets ("Dialog2") . ListBoxes  ("List Box 4")
    For  i = 1  To  DialogSheets ("Dialog2") . ListBoxes ("List Box 4") . ListCount
    DialogSheets ("Dialog2") . ListBoxes ("List Box 4") . Selected (i)  =  False
    Next  i
    Sheets ("2EntSingle") . Select
    Range ("A13:A51") . ClearContents
    DialogSheets ("Dialog2") . Show  
    'Transfer list from dialogbox:
j  =  13  [code]
  For  I  =  1  
To  DialogSheets ("Dialog2") . ListBoxes ("List Box 4") . ListCount
    If  DialogSheets ("Dialog2") . ListBoxes ("List Box 4") . Selected (i)  =  True
  Then Sheets ("2EntSingle") . Cells (j, 1) . Value  = DialogSheets ("Dialog2") . ListBoxes ("List Box 4") .List (i)
    J  =  j  + 1
    End  If
    Next  i
End Sub


Mod Edit: Please, next time, use code tags, like so :code:
Thanks :)

This post has been edited by PsychoCoder: 19 Jan, 2008 - 09:51 PM
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: I Need To Designate A Column For List Box
19 Jan, 2008 - 11:08 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,655



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
You see where it says this in your code...

CODE

Sheets ("2EntSingle") . Cells (j, 1) . Value


Change the 1 to a 2 for the second column, or a 3 for the third column etc. J represents the row and the 1 is where your column number is. This should get you working.

Enjoy!

"At DIC we be excel column manipulating code ninjas!" decap.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 06:35PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month