To change syntax of [a17:M17].Borders(Var(brdr)).Weight = xlThin to [A & rw & :M" & rw ].Borders(Var(brdr)).Weight = xlThin

SamDsouza

Board Regular
Joined
Apr 16, 2016
Messages
205
Hi Can someone help me to obtain the correct syntax for the following

VBA Code:
Dim brdr As Long
Dim Var As Variant
dim rW as Long

rw = 17

Var = Array(xlEdgeLeft, xlEdgeRight, xlInsideVertical, xlInsideHorizontal)
For brdr = LBound(Var) To UBound(Var)
   [a17:M17].Borders(Var(brdr)).Weight = xlThin  
Next brdr
Want to change for below syntax
Code:
[a17:M17].Borders(Var(brdr)).Weight = xlThin
to
Code:
" [A" & rw & ":M" & rw &" ]".Borders(Var(brdr)).Weight = xlThin

SamD
144
 
Last edited by a moderator:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try
VBA Code:
Range("A" & rw & ":M" & rw).Borders(Var(brdr)).Weight = xlThin
 
Upvote 0
Mark858 beat me too it, but leave out the double dot
 
Upvote 0
Dear Sirs,
Thank you so much
.Range("A" & Rw & ":M" & Rw).Borders(Var(brdr)).Weight = xlThin
Edited thanks, Bad copy and paste ;)
Mark858 Your Syntax is absoluetly right with ":" much required
Rather Efficient, Excellent "Copy and Paste"
else trying
Mole999's suggestion we get error using without ":"



Thanks
SamD
145
 
Upvote 0
Mole999 suggest get error without ":"
@mole999 wasn't talking about the : , there was a double period after the range that I edited to a single period.

Happy that you have it working and thanks for the feedback.
 
Upvote 0
Though you guys are masters in techincal terms and coding . BTW what would be double period mean against the single period. just for the knowledge for this thread.

SamD
146
 
Upvote 0
BTW what would be double period mean against the single period. just for the knowledge for this thread.
You would get a syntax error and so the code wouldn't run, it was there purely because of a pasting error as I tested without your array variable.
 
Upvote 0
Though you guys are masters in techincal terms and coding . BTW what would be double period mean against the single period. just for the knowledge for this thread.

SamD
146
range().. dosen't work only singles
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

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