LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,358
Default Data Validation - select AcctName and AcctCodes shows

Cool. Yeah, my VBA is still pretty bad, and I am learning. I get it to do
what I need done, but beyond that.... :) Happy days!
--
John C


"SJAdams4444" wrote:

I should thank you John C, not only have you helped me with this code, but
you have also got me learning, and I greatly appreciate that.
I actually was able to figure out that problem. If you add in
If isect = 1 Then
******* If Target.Count 1 Then Exit Sub
If Target = "" Then NullCheck = "Y"
If NullCheck = "N" Then
If Application.WorksheetFunction.CountIf(Look3, Target) = 0
Then
Look2 = Application.WorksheetFunction.VLookup(Target,
TblLkUp, 2, False)
Target = Look2
End If
End If

The code will work when you are working with more than one cell at a time in
the row.


"SJAdams4444" wrote:

Well John C I am very much hoping you will return to answer another question.

The last code you gave me works beautifully, but it still runs into one
error...
I can clear contents of the cells on at a time without an error, but if i
try to select more than one cell and clear the contents, it runs into an
error on the
If Target = "" Then NullCheck = "Y"
line, saying that there is a type mismatch.
Is there another way to set the nullcheck that can account for the "multiple
nulls" that arise from doing a ClearContents on multiple cells?


"John C" wrote:

Starting new portion of thread, as the other keeps scooting to the right.....
I got rid of the Look1 variable, and added a checker to ensure that it fits
into your range. I currently have this code set up for $A$2:$A$1000, if you
are going to be going beyond 1000 rows on your Main tab, then you will need
to increase that number.

My new VBA code...

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Look2 As Variant
Dim Look3 As Range
Dim NullCheck As String
Dim TblLkUp As Range
Dim isect As Integer
isect = 1
Set TblLkUp = Worksheets("Data").Range(Worksheets("Data").Range( "$E$1"))
Set Look3 = Worksheets("Data").Range(Worksheets("Data").Range( "$F$1"))
NullCheck = "N"
If Intersect(Target, Range("$A$2:$A$10000")) Is Nothing Then
isect = 0
End If
If isect = 1 Then
If Target = "" Then NullCheck = "Y"
If NullCheck = "N" Then
If Application.WorksheetFunction.CountIf(Look3, Target) = 0 Then
Look2 = Application.WorksheetFunction.VLookup(Target,
TblLkUp, 2, False)
Target = Look2
End If
End If
End If
End Sub



--
John C


"SJAdams4444" wrote:

I want to be able to create a drop down list in ONE cell that shows names of
certain accounts, but when you select the name of the account, the number
corresponding to that account shows in the SAME cell. Is this at all
possible?



 
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
Auto Complete a select from a data validation list Lele Excel Discussion (Misc queries) 6 April 6th 09 10:17 PM
Data validation, select from list: omit blanks? George[_3_] Excel Discussion (Misc queries) 1 December 8th 07 06:22 PM
data validation - select multiple options? A. Excel Discussion (Misc queries) 3 January 2nd 06 09:13 PM
Using a 'Select' (Data Validation) List? [email protected] Excel Worksheet Functions 6 November 30th 05 06:42 PM
How to dynamically select a validation list from data in a cell? sessc Excel Discussion (Misc queries) 1 July 28th 05 06:11 PM


All times are GMT +1. The time now is 05:11 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"