border for if
Hi,
It is possible that something you are doing with the macro being called is
causing the code to interrupt and exit. Try running the code, but where you
call your other macro, temporarily replace that line with:
MsgBox rCell.Address
This will display a message box with the cell address everytime a cell
containing the border is found. If this works on its own (and it should),
then the problem lies in the program being called...in that case you may need
to post that code so it can be modified to work...
Hope this helps...
"SteveDB1" wrote:
XP,
Thank you for the response.
This appears to work, but I've noticed something that caught me by surprise.
It appears to cut out, and stop at a certain point-- I'm assuming when it
finds a cell with no bottom border. Yet, when I go to check if the border
exists, it's there-- according to the page format window.
"XP" wrote:
I'm not sure exactly what you are looking for, but the following example
would loop through the used range (filled range) of column A (one) looking at
each cell. It would call another macro if the current cell contains a bottom
border that is solid.
Does this help?
Dim rCell As Range
For Each rCell In ActiveSheet.UsedRange.Columns(1).Rows
If rCell.Borders(xlEdgeBottom).LineStyle = xlSolid Then
Run "MyMacro"
End If
Next rCell
"SteveDB1" wrote:
Hi all.
On one of my macros, I want to set it up to run through a single sheet until
it finds the last row of contents.
However, I want it to only do select cells, that are bounded by borders.
I.e., instead of my having to activate for each cell group, I'd like to
I thought something like this would do it, but I'm missing something.
dim i as integer
dim myRng as range
for i = 1 to lastcell ' where lastcell is the last row with data.
set myRng = nothing
set myRng = ?
if myRng.Border(xlEdgeBottom) < true then
Run "MyMacro"
Else : myRng.cells(?) = offset (1,0) 'down one row, zero columns
end if
next i
I'm sure something needs to be stated differently, I just haven't figured
out what, yet.
Thank you.
Best.
|