CsJHUN
Active Member
- Joined
- Jan 13, 2015
- Messages
- 360
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
- Mobile
Hi guys, i would like to identify one row on a table with multiple merged cells in multiple column. Imagine something like this:
to identify the row the data has to be the same in (for exapmple) col A, Col B, Col D, Col E, Col F. However Col F is not merged and should not contain merged cells, but the values within the cells could be the same, but different content of Col A, B, D, E, F. I hope that makes sense.
I started with for each loop from left to right
so finding the first column rows, then finding the 2.nd column rows, within 1st, then 3rd rows, within 2nd, .... eventualy identify the row.
Then if i have the row, i have to check the values within the cells(merged or not) if it has the same value as the original file ( from which i started the macro)#for
But still gives me errors, sometimes 400, object not valid, object error.
Any solution? What did i wrong? What is missing?
Ashok L. 300-7 round PC v1 DFMEA control prevention új.xlsx | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | |||
1 | Col A | Col B | Col C | Col D | Col E | Col F | Col G | Col H | Col I | Col J | Col K | ||
2 | |||||||||||||
3 | |||||||||||||
4 | |||||||||||||
5 | |||||||||||||
6 | |||||||||||||
7 | |||||||||||||
8 | |||||||||||||
9 | |||||||||||||
10 | |||||||||||||
11 | |||||||||||||
12 | |||||||||||||
13 | |||||||||||||
14 | |||||||||||||
15 | |||||||||||||
16 | |||||||||||||
17 | |||||||||||||
18 | |||||||||||||
19 | |||||||||||||
20 | |||||||||||||
21 | |||||||||||||
Munka2 |
to identify the row the data has to be the same in (for exapmple) col A, Col B, Col D, Col E, Col F. However Col F is not merged and should not contain merged cells, but the values within the cells could be the same, but different content of Col A, B, D, E, F. I hope that makes sense.
I started with for each loop from left to right
VBA Code:
Dim cell_a as Range, cell_b as range...
...
'assing values for identifying row
t_find_a = "blahbla1"
t_find_b = "blahbla2"
t_find_d = "blahbla3"
t_find_e = "blahbla4"
t_find_f = "blahbla5"
'now opening the another workbook where i need to identify the row
set findfile = workbook.open(t_findfile_path)
lra = range("A" & rows.count).end(xlup).row
for each cell_a in findfile.sheets(1).range("A10:A" & lra)
if cell_a_value = t_find_a then
cell_b_start = cell_a.row
cell_b_area = cell_a.mergearea.count -1
'this sould narrow the search for column b
for each cell_b in range(cells(cell_b_start, "B"), cells(cell_b_start+cell_b_area , "B")
cell_d_start = cell_b.row
cell_b_area= cell_b.mergearea.count -1
for each cell_d...
....
..
next cell_d
next cell_b
next cell_a
Then if i have the row, i have to check the values within the cells(merged or not) if it has the same value as the original file ( from which i started the macro)#for
But still gives me errors, sometimes 400, object not valid, object error.
Any solution? What did i wrong? What is missing?
Last edited by a moderator: