Hi Bob,
I also thought of adding a test at the start of the button code, but I
really don't know how. I'm still a very basic VB user. All I can do is
to record macros and fiddle a little bit about them.
The area to enter new information is 3 cells (B6
6), which entries I
concatenate and vlookup in the database (patterns!G:H) for existency.
Formula in G6:
=IF(ISERROR(VLOOKUP(CONCATENATE(B6,C6,D6),patterns!G:H,2,FALSE)),"not
defined yet",VLOOKUP(CONCATENATE(B6,C6,D6),patterns!G:H,2,FALSE))
when the entry exists, I get back the previously allocated Pattern
number,
once the entry doesn't exist, I get back the message "not defined yet"
I can see on the result, if the pattern exists or not, so I (with
stress on "I") know, when not to press the button, but the user I'm
writing the spreadsheet for, might not and I have to avoid same
entries with different allocated Pattern numbers (which will be given
in consecutive order for newly entered datasets).
this is my button code:
Sub INPUT_PATTERN()
'
Application.ScreenUpdating = False
Sheets("patterns").Select
Cells.Select
Selection.EntireColumn.Hidden = False
Columns("A:A").Select
Selection.EntireColumn.Hidden = True
Range("B8:H8").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Range("C8:E8").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("H8").Select
Selection.ClearContents
Range("B2:H2").Select
Selection.Copy
Range("B8").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
True, Transpose:=False
Application.CutCopyMode = False
Application.Run "'conversion.xls'!SORT_FABRICS"
Range("B:B,G:G").Select
Range("G1").Activate
Range("C7").Select
Selection.EntireColumn.Hidden = True
Sheets("CONVERSION").Select
End Sub
Hope You can help me now.
Regards,
Norbert