Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Simplify Code for Borders

Trying to work thru all my existing codes to "chop" them into smaller pieces,
clean them up, re-arrange how they work together, etc.

I have seen samples of code for borders that greatly improve the "recorded"
macros. My attempt, as follows, fails, as I really don't know what I am doing.

My Original code will provide instruction as to what range the borders are
reqiured on. Then Call BorderInThin

Sub BorderInThin

With Selection.Borders = Array(xlInsideVertical, xlInsideHorizontal)
.LineStyle = xlSolid
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

QUESTIONS:
1: What changes required to make the above work.
2: Where can one find detailed definitions of code expressions.
For example, using the "recorded" macro, I can comment out lineStyle =
xlSolid, AND LineStyle = xlContinuous and ColorIndex = xlAutomatic with no
APPARENT change in how the code works. I have to assume I'm missing something
here, as well. I expect some definitions would be a good start.
3: I want to take a course on VBA that starts right back in "kindergarten".
However, everyone seems to have switched the courses to MS Office 2007.
My company is still working with 2003 (and OO).
Is 2007 still using the same language?
If yes, I presume a current course would still be of benefit to learn
the basics I
am missing?
I hope someone can guide me on these issues.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Simplify Code for Borders

Sub BorderInThin()

' With Selection.Borders = Array(xlInsideVertical, xlInsideHorizontal)
' .LineStyle = xlSolid
' .LineStyle = xlContinuous
' .Weight = xlThin
' .ColorIndex = xlAutomatic
' End With

'New code
myBorders = Array(, xlInsideVertical, xlInsideHorizontal)
For i = 1 To UBound(myBorders)
With Selection.Borders(myBorders(i))
.LineStyle = xlContinuous
.Weight = xlThin 'Medium
End With
Next
End Sub
'you may like this
Sub DoBorders() 'does inside and outside
With Selection
..Borders.LineStyle = xlContinuous
..BorderAround Weight:=xlMedium
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"BEEJAY" wrote in message
...
Trying to work thru all my existing codes to "chop" them into smaller
pieces,
clean them up, re-arrange how they work together, etc.

I have seen samples of code for borders that greatly improve the
"recorded"
macros. My attempt, as follows, fails, as I really don't know what I am
doing.

My Original code will provide instruction as to what range the borders are
reqiured on. Then Call BorderInThin

Sub BorderInThin

With Selection.Borders = Array(xlInsideVertical, xlInsideHorizontal)
.LineStyle = xlSolid
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

QUESTIONS:
1: What changes required to make the above work.
2: Where can one find detailed definitions of code expressions.
For example, using the "recorded" macro, I can comment out lineStyle =
xlSolid, AND LineStyle = xlContinuous and ColorIndex = xlAutomatic with no
APPARENT change in how the code works. I have to assume I'm missing
something
here, as well. I expect some definitions would be a good start.
3: I want to take a course on VBA that starts right back in
"kindergarten".
However, everyone seems to have switched the courses to MS Office 2007.
My company is still working with 2003 (and OO).
Is 2007 still using the same language?
If yes, I presume a current course would still be of benefit to learn
the basics I
am missing?
I hope someone can guide me on these issues.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Simplify Code for Borders

There is a good tool that comes with the legal versions of Excel called VBA
help files. You access those files by opening the VB editor, Alt + F11, and
clicking the blue circle with the question mark. Then type a key word to
search in the seach box and press enter. A menu of tipics will appear from
which you can select one that looks like it might contain information you
want to know. You might have to experiment with this method until you
understand hou it is organized. These files contain sample code that you can
copy and use in your projects. Of course, some modifications may be required
to meet specific needs. Most questions that are posed in this forum are
answered in the VBA help files, if an individual is willing to spend some
time learning to use these files. Obviously, there are quite a few who are
not willing to spend the time, or do not know that they are available.

"BEEJAY" wrote:

Trying to work thru all my existing codes to "chop" them into smaller pieces,
clean them up, re-arrange how they work together, etc.

I have seen samples of code for borders that greatly improve the "recorded"
macros. My attempt, as follows, fails, as I really don't know what I am doing.

My Original code will provide instruction as to what range the borders are
reqiured on. Then Call BorderInThin

Sub BorderInThin

With Selection.Borders = Array(xlInsideVertical, xlInsideHorizontal)
.LineStyle = xlSolid
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

QUESTIONS:
1: What changes required to make the above work.
2: Where can one find detailed definitions of code expressions.
For example, using the "recorded" macro, I can comment out lineStyle =
xlSolid, AND LineStyle = xlContinuous and ColorIndex = xlAutomatic with no
APPARENT change in how the code works. I have to assume I'm missing something
here, as well. I expect some definitions would be a good start.
3: I want to take a course on VBA that starts right back in "kindergarten".
However, everyone seems to have switched the courses to MS Office 2007.
My company is still working with 2003 (and OO).
Is 2007 still using the same language?
If yes, I presume a current course would still be of benefit to learn
the basics I
am missing?
I hope someone can guide me on these issues.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Simplify Code for Borders

Again: Gentlemen: I did it wrong. Didn't respond to Group. I think I got it
now.

Message was as follows:

Gentlemen:

This is the first time I'm trying to communicate/respond using the
newsreader. I hope it works as expected. (in other words, I hope I set it up
properly)

Don: Thanks for the samples. Will study ( and use )them.

JLGWhiz: Mia Culpa. Previous attempts a viewing the help file was
intimidating. With your push, I just did some research on a few specific
(small) items and lo and behold, I LIKE IT!!. In future, I'll surely spend
time in "there", rather than muddling around for days, then asking the ng in
desperation and utter frustration.

I will also enlighten some of my co-workers who expect me to find all the
answers for them.

Again, Thanks a bunch.

"JLGWhiz" wrote in message
...
There is a good tool that comes with the legal versions of Excel called
VBA
help files. You access those files by opening the VB editor, Alt + F11,
and
clicking the blue circle with the question mark. Then type a key word to
search in the seach box and press enter. A menu of tipics will appear
from
which you can select one that looks like it might contain information you
want to know. You might have to experiment with this method until you
understand hou it is organized. These files contain sample code that you
can
copy and use in your projects. Of course, some modifications may be
required
to meet specific needs. Most questions that are posed in this forum are
answered in the VBA help files, if an individual is willing to spend some
time learning to use these files. Obviously, there are quite a few who
are
not willing to spend the time, or do not know that they are available.

"BEEJAY" wrote:

Trying to work thru all my existing codes to "chop" them into smaller
pieces,
clean them up, re-arrange how they work together, etc.

I have seen samples of code for borders that greatly improve the
"recorded"
macros. My attempt, as follows, fails, as I really don't know what I am
doing.

My Original code will provide instruction as to what range the borders
are
reqiured on. Then Call BorderInThin

Sub BorderInThin

With Selection.Borders = Array(xlInsideVertical, xlInsideHorizontal)
.LineStyle = xlSolid
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

QUESTIONS:
1: What changes required to make the above work.
2: Where can one find detailed definitions of code expressions.
For example, using the "recorded" macro, I can comment out lineStyle
=
xlSolid, AND LineStyle = xlContinuous and ColorIndex = xlAutomatic with
no
APPARENT change in how the code works. I have to assume I'm missing
something
here, as well. I expect some definitions would be a good start.
3: I want to take a course on VBA that starts right back in
"kindergarten".
However, everyone seems to have switched the courses to MS Office
2007.
My company is still working with 2003 (and OO).
Is 2007 still using the same language?
If yes, I presume a current course would still be of benefit to learn
the basics I
am missing?
I hope someone can guide me on these issues.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Simplify Code for Borders

glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"BEEJAY" wrote in message
...
Again: Gentlemen: I did it wrong. Didn't respond to Group. I think I got
it now.

Message was as follows:

Gentlemen:

This is the first time I'm trying to communicate/respond using the
newsreader. I hope it works as expected. (in other words, I hope I set it
up properly)

Don: Thanks for the samples. Will study ( and use )them.

JLGWhiz: Mia Culpa. Previous attempts a viewing the help file was
intimidating. With your push, I just did some research on a few specific
(small) items and lo and behold, I LIKE IT!!. In future, I'll surely spend
time in "there", rather than muddling around for days, then asking the ng
in desperation and utter frustration.

I will also enlighten some of my co-workers who expect me to find all the
answers for them.

Again, Thanks a bunch.

"JLGWhiz" wrote in message
...
There is a good tool that comes with the legal versions of Excel called
VBA
help files. You access those files by opening the VB editor, Alt + F11,
and
clicking the blue circle with the question mark. Then type a key word to
search in the seach box and press enter. A menu of tipics will appear
from
which you can select one that looks like it might contain information you
want to know. You might have to experiment with this method until you
understand hou it is organized. These files contain sample code that you
can
copy and use in your projects. Of course, some modifications may be
required
to meet specific needs. Most questions that are posed in this forum are
answered in the VBA help files, if an individual is willing to spend some
time learning to use these files. Obviously, there are quite a few who
are
not willing to spend the time, or do not know that they are available.

"BEEJAY" wrote:

Trying to work thru all my existing codes to "chop" them into smaller
pieces,
clean them up, re-arrange how they work together, etc.

I have seen samples of code for borders that greatly improve the
"recorded"
macros. My attempt, as follows, fails, as I really don't know what I am
doing.

My Original code will provide instruction as to what range the borders
are
reqiured on. Then Call BorderInThin

Sub BorderInThin

With Selection.Borders = Array(xlInsideVertical, xlInsideHorizontal)
.LineStyle = xlSolid
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

QUESTIONS:
1: What changes required to make the above work.
2: Where can one find detailed definitions of code expressions.
For example, using the "recorded" macro, I can comment out
lineStyle =
xlSolid, AND LineStyle = xlContinuous and ColorIndex = xlAutomatic with
no
APPARENT change in how the code works. I have to assume I'm missing
something
here, as well. I expect some definitions would be a good start.
3: I want to take a course on VBA that starts right back in
"kindergarten".
However, everyone seems to have switched the courses to MS Office
2007.
My company is still working with 2003 (and OO).
Is 2007 still using the same language?
If yes, I presume a current course would still be of benefit to
learn
the basics I
am missing?
I hope someone can guide me on these issues.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I simplify a VB code?????? hoyos Excel Discussion (Misc queries) 1 November 6th 09 09:06 PM
Simplify Code help DavidH56 Excel Programming 14 September 23rd 08 11:37 PM
Need to simplify code alexwren Excel Discussion (Misc queries) 7 August 15th 06 08:07 PM
simplify code matt Excel Discussion (Misc queries) 3 September 28th 05 11:53 PM
Help to simplify code. Michael Beckinsale Excel Programming 0 September 2nd 03 10:26 AM


All times are GMT +1. The time now is 04:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"