I'm trying to go through the code but I don't understand exactly what it's doing.
I went through and tried to understand the code. Please correct me if I'm wrong. I want to learn this and I put my best guess out there.
If I'm understanding this code correctly, it will only look in the first column. If I change (j,1) to (2,j) would it be looking in row 2 going across? If row 2 does not activate the if, then I'd need it to continue sequentially until it finds a blank.
Sorry If I'm a bother, I'm really trying to figure this out.
sub M_snb() with documents.open("G:\OF\example.docx") 'does this go into a folder and apply this to all documents in the folder?
for j=1 to .tables(1).rows.count 'starts a loop in the tables. is it counting rows?
if len(.tables(1).cell(j,1).range)=1 then 'len was used to count characters in excel (is it short for length?), does it do the same here? if so, does this line say "If table cell 1,1 is one character long then...end if"? If I change this to 0, would it work with blank cells?
.tables(1).cell(j,1).range.text="...." 'I think this finds the table, identifies the cell 1,1 and puts text in it, assuming there count of the cell was one as above.
exit for 'exits the loop if above is true
end if
next 'this will continue until it finds a cell with one character, correct? (J,1)
.close -1 '.close closes the document? what does the -1 do?
end with
End sub
[/