Minggu, 17 Februari 2013

[ExcelVBA] Re: Is there a better way to populate textboxes. I'm using a combobox, vba &vlookup

 

Dan,
It's very difficult to picture your layout and the integrity of the data and its variability. Is there anyway you could upload a version of your file somewhere (on the interweb if you can't upload to the files area here) and link to it here so that to test code we don't have to try (and guess - possibly wrongly) your data layout and your userform and its controls and its code.

The last 2 blocks of some 10 lines each of your code at first sight seem to be indentical(?)
You could use a loop, something like this, but it's difficult for me to test:

For i = 1 To 10
Controls("txtCorePB" & i).Value = WorksheetFunction.VLookup(txtCoreComp.Value _
& txtAdapterConfig.Value & txtShellSize.Value, myCoreRange, i + 4, False) * _
txtCoreMultiplier.Value
Next i

--- In ExcelVBA@yahoogroups.com, "daniel d" wrote:
>
>
> After more research, it appears inconsistent data has been the cause of the errors. I'm trying to determine if I can standardize the data or deal with the errors with error handling of some kind.
>
> In the vloookup I'm looking for three criteria in the look-up field.
> The criteria comes from the columns in the combobox.
>
> Here is a sample of the first few columns:
> PARTNUM
> CORE
> CORE_MULTIPLIER
> ADAP_CONFIG
> ENTRY_ADDER
> ENV
> ENTRY_SIZE
> CLAMP_NBR
> LEN_OPT
>
>
> Sometimes there is no adapter configuration
> sometimes the shell size is included in the adapter configuration field, so that if the user enters a shell size in txtShellSize, there will be an error.
>
> And sometimes in the lookup range there is no shell size.
>
> I was using select case to check for missing data in the lookup criteria, but I don't know how to error trap when there is missing data in the lookup range.
>
> So maybe something will come to me this weekend.
>
> Dan
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (9)
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar