LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Amend form code to allow an option

If MsgBox("Do you wish to use the Master SubContractor/" _
& "Suppliers" & vbNewLine & "trade reference codes, or" _
& "rename them again?", vbYesNo) = vbYes Then
Call DataStoreCodes(wkbkname)
Else
frmName_Contractors.lbDataCode.List = _
Workbooks(wkbkname).Worksheets _
("DataStore").Range("G1", "G" & Rows.Count).Value
With Workbooks(wkbkname).Sheets("DataStore")
.Unprotect
.Range("G1", "G" & .Rows.Count).ClearContents
End With
End If

frmName_Contractors.Show

If user choses Yes, then all is fine. The sub 'DataStoreCodes'
loads col1 in the listbox of frmName_Contractors.Show
with all the codes in the user's workbook, and then checks them
against a sheet (MasterDataStore) in an addin. If the code is in the
addin, then it's loaded into Col2 in the listbox against the relevent
item.

If user chooses No, then I cannot get it to work.
The range is correctly added into Col! of the listbox, and when the
form displays, Col2 is (correctly) empty of values.
At this point user should be able to click on a Col1 entry then go
to a textbox where they type the corresponding Col2 value.

Doing this gives an error:
"Could not get the Column property....Invalid argument"

Here is the form code:

Private Sub lbDataCode_Click()
If lbDataCode.ListIndex < -1 Then
If lbDataCode.Column(1, lbDataCode.ListIndex) < "" Then
tbCtrTrade.Text = lbDataCode.Column(1, lbDataCode.ListIndex)
tbCtrTrade.SetFocus
tbCtrTrade.SelStart = 0
tbCtrTrade.SelLength = Len(tbCtrTrade.Text)
Else
tbCtrTrade.Text = ""
tbCtrTrade.SetFocus
End If
Else
tbCtrTrade.Text = ""
End If
End Sub

Private Sub tbCtrTrade_AfterUpdate()
If lbDataCode.ListIndex < -1 Then
If tbCtrTrade.Text < "" Then
lbDataCode.Column(1, lbDataCode.ListIndex) _
= tbCtrTrade.Text
End If
End If
End Sub

How may I amend this code, please?.

Regards.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003


 
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
amend a VB code please Morgan Excel Discussion (Misc queries) 0 March 3rd 10 11:17 PM
Amend the DV0022 - Update Validation Selections code for more lists [email protected] Excel Worksheet Functions 1 January 4th 09 01:19 PM
Option Buttons in a Form Idaho Word Man Excel Discussion (Misc queries) 7 April 21st 08 09:58 PM
Controlling an Option Group in a User Form SaeOngJeeMa Excel Discussion (Misc queries) 0 November 29th 06 08:17 AM
end down option in a textbox of a form DTGvet Excel Discussion (Misc queries) 1 June 15th 06 02:01 PM


All times are GMT +1. The time now is 08:48 AM.

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"