+ Reply to Thread
Results 1 to 2 of 2

ListBox - TextBox - Range on Sheet

  1. #1
    Registered User
    Join Date
    02-19-2005
    Posts
    4

    ListBox - TextBox - Range on Sheet

    Hey everybody

    I currently have a macro set up to allow the user to add data to a list. When data is added to a list, the system does a search on the worksheet range and finds the related data from the same row, and puts in a textbox for easy viewing.

    I now want to take each item from the ListBox, find the related info from the TextBox or sheet or where-ever, and put it in a new sheet in a specified range.

    I've started with the following code:
    c = -1
    LabelsForm.Hide
    Workbooks.Open ("C:\Documents and Settings\Sarah\My Documents\Labels.xls")

    For i = 1 To 16
    LabelsForm.ListBox.ListIndex = c + i
    Windows("Labels.xls").Activate
    Range("A" & i).Activate
    ActiveCell.Value = LabelsForm.TextBox.Value
    Next

    Everytime the ListIndex changes, another Sub is called up as follows
    indPl = LabelsForm.ListBox.Text
    Range("A1").Select
    Cells.Find(What:=indPl, After:=ActiveCell).Activate
    LabelsForm.TextBox.Value = ActiveCell.Value & vbCrLf & ActiveCell.Offset(0, 1).Value & vbCrLf & ActiveCell.Offset(0, 2).Value & vbCrLf & ActiveCell.Offset(0, 3).Value & vbCrLf & ActiveCell.Offset(0, 4).Value

    Everytime I run my macro, I come back with Runtime Error 91 Object variable not set, and it highlights the Cells.Find line in the second sub mentioned above. I never have any problems with this line, if I'm not using the first Sub.

    Can anyone help????????????????????????
    Regards Sarah

  2. #2
    Registered User
    Join Date
    02-19-2005
    Posts
    4

    Smile Reply

    I found my own answer.

    When the second part got pulled in, the wrong workbook was activated, so all I had to do was activate the other workbook

    Cheers, Sarah.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1