ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If < equal to named list require user to fill out desired columns? (https://www.excelbanter.com/excel-programming/384556-if-equal-named-list-require-user-fill-out-desired-columns.html)

Matt Pierringer

If < equal to named list require user to fill out desired columns?
 
I have a named list of part numbers. I already have conditional
formatting on the cells in column A to test if it is equal to any of
the part numbers in the list. If it is not equal to the list it will
change colors to green signifying that it is adding a new part number
to the database. I would like to require the user to fill out the
next 7 columns and leave the rest to be optional.
I am grateful for any suggestions!

Thanks,
Matt


JLGWhiz

If < equal to named list require user to fill out desired columns
 
Assuming that the cell containing the active part is the ActiveCell:

'Test for new item
If ActiveCell.Interior.Color = vbGreen Then
ActiveCell.Offset(0, 1) = InputBox("Enter data", "Column B")
ActiveCell.Offset(0, 2) = InputBox("Enter data", "Column C")
ActiveCell.Offset(0, 3) = InputBox("Enter data", "Column D")
ActiveCell.Offset(0, 4) = InputBox("Enter data", "Column E")
ActiveCell.Offset(0, 5) = InputBox("Enter data", "Column F")
ActiveCell.Offset(0, 6) = InputBox("Enter data", "Column G")
ActiveCell.Offset(0, 7) = InputBox("Enter data", "Column H")
End If

This is psuedo code only to give you an idea of how it can be done.

"Matt Pierringer" wrote:

I have a named list of part numbers. I already have conditional
formatting on the cells in column A to test if it is equal to any of
the part numbers in the list. If it is not equal to the list it will
change colors to green signifying that it is adding a new part number
to the database. I would like to require the user to fill out the
next 7 columns and leave the rest to be optional.
I am grateful for any suggestions!

Thanks,
Matt



Matt Pierringer

If < equal to named list require user to fill out desired columns
 
On Mar 5, 8:28 pm, JLGWhiz wrote:
Assuming that the cell containing the active part is the ActiveCell:

'Test for new item
If ActiveCell.Interior.Color = vbGreen Then
ActiveCell.Offset(0, 1) = InputBox("Enter data", "Column B")
ActiveCell.Offset(0, 2) = InputBox("Enter data", "Column C")
ActiveCell.Offset(0, 3) = InputBox("Enter data", "Column D")
ActiveCell.Offset(0, 4) = InputBox("Enter data", "Column E")
ActiveCell.Offset(0, 5) = InputBox("Enter data", "Column F")
ActiveCell.Offset(0, 6) = InputBox("Enter data", "Column G")
ActiveCell.Offset(0, 7) = InputBox("Enter data", "Column H")
End If

This is psuedo code only to give you an idea of how it can be done.

"Matt Pierringer" wrote:
I have a named list of part numbers. I already have conditional
formatting on the cells in column A to test if it is equal to any of
the part numbers in the list. If it is not equal to the list it will
change colors to green signifying that it is adding a new part number
to the database. I would like to require the user to fill out the
next 7 columns and leave the rest to be optional.
I am grateful for any suggestions!


Thanks,
Matt


Well... thanks, but since it is only a conditional formatting that is
setting the color, vb did not recognize it as "vbGreen" which actually
I had to change ".Interior.Color = vbGreen" to ".Font.ColorIndex =
10"(I tested 10 with two other cells with vb to determine that was in
fact the correct color #). I think the problem is that conditional
formatting does not actually set those properties, hence you can not
test for them. Any other ideas?

Thanks,
Matt Pierringer



All times are GMT +1. The time now is 12:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com