awale
08-24-2015, 06:49 AM
Hello Everyone.
I am having problems with a VBA Excel 2010 program code.
I am trying to read data from a spreadsheet on excel 2010. what I have is a set of data (see below) and I am trying to write a code that will let me use a msg box and ask me to write down the name I am looking for e.g. "Name 1" from the list of names in the column and then I want to set a criteria where if the number in the columns are equal to zero and again for a different column = 0 ("name 5"), then highlight red any number in column "Name 8 and Name 9" that is greater than let say 30 (just a random example). the important thing is, the red highlight of column "Name 8/9" must only occur if the numbers is row "Name 1" and "Name 5" are equal to zero.
I have already done this but I only used the column numbers e.g. A1:A5. now I need to use the name of the column because I want to use the code for a different excel spreadsheets but the names of columns are in different positions for each excel sheet, but if I use the names, no matter which column along excel they are I will always find the right column I am looking for and set the criteria.
the criteria for "Name 1/5" will always be = 0 or =1 but the program has to ask me to choose that when I search for it.
if you look below at the example, you can see the red highlight are when criteria of =0 is met for Name 1 and Name 5 and the number in Name8/9 are greater than 30. when it is not greater than 30 and it still meets the criteria it is highlighted blue in the excel spreadsheet example. ALL OTHER NAMES MUST BE IGNORED.
SEE EXAMPLE BELOW hopefully this will make sense. “hopefully"
Name 1
Name 2
Name 3
Name 4
Name 5
Name 6
Name 7
Name 8
Name 9
Name 10
0
0
1
0
0
1
58
35
14
19
0
0
0
0
0
1
41
45
68
74
1
0
1
0
1
0
23
18
98
87
0
0
1
0
0
1
65
36
52
89
0
0
0
0
1
1
24
95
47
75
1
1
1
0
1
0
58
87
59
14
0
1
0
0
0
0
74
41
84
32
1
1
0
0
1
0
96
25
74
96
0
0
0
0
0
0
87
35
15
53
0
0
1
0
0
1
57
49
48
47
1
0
1
0
1
1
63
84
23
65
0
1
0
0
0
0
21
54
69
12
0
0
1
0
0
0
54
23
54
54
1
1
0
0
1
1
88
34
77
88
0
0
1
0
0
0
78
48
68
69
1
0
1
0
0
1
96
87
14
65
1
0
0
0
1
0
21
96
54
25
0
1
0
0
0
0
54
72
78
29
0
1
1
0
0
1
62
38
22
78
0
0
0
0
0
0
21
49
65
54
1
0
1
0
1
1
17
65
98
99
0
0
0
0
0
0
59
15
56
70
0
1
1
0
0
0
36
12
29
54
1
0
0
0
1
0
29
49
55
54
:help :banghead: :think:
I am having problems with a VBA Excel 2010 program code.
I am trying to read data from a spreadsheet on excel 2010. what I have is a set of data (see below) and I am trying to write a code that will let me use a msg box and ask me to write down the name I am looking for e.g. "Name 1" from the list of names in the column and then I want to set a criteria where if the number in the columns are equal to zero and again for a different column = 0 ("name 5"), then highlight red any number in column "Name 8 and Name 9" that is greater than let say 30 (just a random example). the important thing is, the red highlight of column "Name 8/9" must only occur if the numbers is row "Name 1" and "Name 5" are equal to zero.
I have already done this but I only used the column numbers e.g. A1:A5. now I need to use the name of the column because I want to use the code for a different excel spreadsheets but the names of columns are in different positions for each excel sheet, but if I use the names, no matter which column along excel they are I will always find the right column I am looking for and set the criteria.
the criteria for "Name 1/5" will always be = 0 or =1 but the program has to ask me to choose that when I search for it.
if you look below at the example, you can see the red highlight are when criteria of =0 is met for Name 1 and Name 5 and the number in Name8/9 are greater than 30. when it is not greater than 30 and it still meets the criteria it is highlighted blue in the excel spreadsheet example. ALL OTHER NAMES MUST BE IGNORED.
SEE EXAMPLE BELOW hopefully this will make sense. “hopefully"
Name 1
Name 2
Name 3
Name 4
Name 5
Name 6
Name 7
Name 8
Name 9
Name 10
0
0
1
0
0
1
58
35
14
19
0
0
0
0
0
1
41
45
68
74
1
0
1
0
1
0
23
18
98
87
0
0
1
0
0
1
65
36
52
89
0
0
0
0
1
1
24
95
47
75
1
1
1
0
1
0
58
87
59
14
0
1
0
0
0
0
74
41
84
32
1
1
0
0
1
0
96
25
74
96
0
0
0
0
0
0
87
35
15
53
0
0
1
0
0
1
57
49
48
47
1
0
1
0
1
1
63
84
23
65
0
1
0
0
0
0
21
54
69
12
0
0
1
0
0
0
54
23
54
54
1
1
0
0
1
1
88
34
77
88
0
0
1
0
0
0
78
48
68
69
1
0
1
0
0
1
96
87
14
65
1
0
0
0
1
0
21
96
54
25
0
1
0
0
0
0
54
72
78
29
0
1
1
0
0
1
62
38
22
78
0
0
0
0
0
0
21
49
65
54
1
0
1
0
1
1
17
65
98
99
0
0
0
0
0
0
59
15
56
70
0
1
1
0
0
0
36
12
29
54
1
0
0
0
1
0
29
49
55
54
:help :banghead: :think: