Excel VBA to know what kind of border it is

JohnSeito

Active Member
Joined
Nov 19, 2007
Messages
390
Does any know of excel code to know what know what kind of border it is. I converted a pdf file and now the data are on excel and there are borders and it looks to me like it is border with thickness of medium but when I run a code I produced and mark X to the column next to it to show that it is that border it gave me X on all the rows and so the medium thick border is excel grid without any borders.

So if anyone could show a code example of what kind of border does an excel has then let me know. thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Is this enough to get you started

MsgBox ActiveCell.Borders(xlEdgeRight).LineStyle
MsgBox ActiveCell.Borders(xlEdgeRight).Weight
 
Upvote 0
In the immediate window, if you type ?xlThick

You'll see that all the border arguments are is numbers.
 
Upvote 0
OK I tested the code again and the border is two for the excel grid. I converted a pdf file onto excel and now it has borders and I tested these converted pdf borders and is also 2.

so my question would be how is the excel grid border and the converted pdf borders are same at two when the pdf borders on excel are darker and thicker?
 
Upvote 0
the thick border are number -4138

but the borders from the converted PDF files are 2 same as no border, plain excel grid.

How would I determined the converted PDF borders on excel?
 
Upvote 0
Is is possible that there are odd characters coming from the PDF that look like a border?
Might this be an issue of the cell's contents rather than its border?
 
Upvote 0
mikerickson,

I have done something like this once in the past, where I converted a file from PDF onto excel and it has all these borders.

I wrote a code to say that if this cell has a border mark X to that row the column next to it. The last time I remember it works and I only did it once and I lost that piece of code.

Now I was to do it again with a remake of that code and it just doesn't work.

example of the most recent code I made:
Code:
x = 2
Do

If Cells(x, "h").Borders(xlEdgeBottom).Weight = xlthin Then
'xlMedium Then
    Cells(x, "I") = "x"

End If

x = x + 1
Loop While x < 3000

this code does not work properly it mark X to all rows even if they didn't have border and just plain excel grid, and if i changed it to xlmedium which is what the borders look like this code will not mark anything.

Is is possible that there are odd characters coming from the PDF that look like a border?

on the pdf it looks like borders, and on excel it does too. So if it is odd charcters, I don't know but from an educated guess probably not, but if you know a code that can read that cell and tell what it is, then we could find out.

Might this be an issue of the cell's contents rather than its border?

if there is a code that can read that cell contents and tell what it is, if it's border or not or something else that would help answer the question. As I have said that I have done this once in the past and it work, but I don't know why it didn't work again, i don't remember the exact code I have use but i know it reads borders.
 
Upvote 0
You can use =LEN(A1) to test if its a content/border issue.
If you copy the cells and pasteSpecial Values, does that remove the "border"?
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,972
Members
448,537
Latest member
Et_Cetera

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top