ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   New to macros! Need Help! (https://www.excelbanter.com/excel-discussion-misc-queries/69030-new-macros-need-help.html)

Asian Mike

New to macros! Need Help!
 
I want to create a macro that will read in a range of cells (ex: i2 - as2)
and then look at each value in the cells. If that value matches a certain
value I would like it to print out a certain phrase. But if it doesn't then I
would like it to not do anything and just move on until it finds the equal
value. Look through a row to find a value and for each case found, print out
a phrase in column.

Example:
If you have table,
x y z
a 1 1 1
b 0 0 1
c 1 1 0

abc are names while xyz and certain topics. if a has a 1 value for any of
the xyz i want it to print out something like:
a x
y
z

b z

c x
y

If I'm not making clear just let me know and I'll try to clarify. Also
remember that I'm new to macros so I might need some additional guidance.

CLR

New to macros! Need Help!
 
Well, assumning you don't really want the results to be "vertical" but rather
just XYZ in one cell.........then with your first 1 starting in B2, you could
put this formula in E2, and copy it down column E and you don't need a
macro.......

=IF(B2=1,"X","")&IF(C2=1,"Y","")&IF(D2=1,"Z","")

Vaya con Dios,
Chuck, CABGx3



"Asian Mike" wrote:

I want to create a macro that will read in a range of cells (ex: i2 - as2)
and then look at each value in the cells. If that value matches a certain
value I would like it to print out a certain phrase. But if it doesn't then I
would like it to not do anything and just move on until it finds the equal
value. Look through a row to find a value and for each case found, print out
a phrase in column.

Example:
If you have table,
x y z
a 1 1 1
b 0 0 1
c 1 1 0

abc are names while xyz and certain topics. if a has a 1 value for any of
the xyz i want it to print out something like:
a x
y
z

b z

c x
y

If I'm not making clear just let me know and I'll try to clarify. Also
remember that I'm new to macros so I might need some additional guidance.



All times are GMT +1. The time now is 07:38 PM.

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