ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Formatting (https://www.excelbanter.com/excel-programming/412062-conditional-formatting.html)

StumpedAgain

Conditional Formatting
 
I have a list of products that I want to search for in my later program with
titles distinguishing the different manufacturers within the table (example
below). The manufacturers won't change any time soon and I want to make an
If Then statement that says: If selection is company A or company B etc. then
copy selection and paste in a certain cell. Because I know the
manufacturers, I was hoping to stear clear of having another list that I have
to loop through to see if Company A = Comapny A in another list or (almost
worse) have a large If Then imbedded statement that has 15 If Then's to match
the number of Companies. Any thoughts? Much thanks in advance!


Company A
Product 1
Product 2
Company B
Product 5
Product 6
etc.

StumpedAgain

Conditional Formatting
 
I resorted to the following. It's longer, but easier to copy/paste than an
if/then.

Select Case curselection.Value
Case "Company1"
curselection.Copy Range("A7").Offset(i + j, 0)
Case "Company2"
curselection.Copy Range("A7").Offset(i + j, 0)
Case "Company3"
curselection.Copy Range("A7").Offset(i + j, 0)
Case "Company4"
curselection.Copy Range("A7").Offset(i + j, 0)
etc.
End Select



"StumpedAgain" wrote:

I have a list of products that I want to search for in my later program with
titles distinguishing the different manufacturers within the table (example
below). The manufacturers won't change any time soon and I want to make an
If Then statement that says: If selection is company A or company B etc. then
copy selection and paste in a certain cell. Because I know the
manufacturers, I was hoping to stear clear of having another list that I have
to loop through to see if Company A = Comapny A in another list or (almost
worse) have a large If Then imbedded statement that has 15 If Then's to match
the number of Companies. Any thoughts? Much thanks in advance!


Company A
Product 1
Product 2
Company B
Product 5
Product 6
etc.



All times are GMT +1. The time now is 06:59 PM.

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