LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Modify code to insert borders

I need the following code (currently operating correctly) changed so that
after the new worksheet (Sheet3, or Sheet4, or Sheet5) is opened, and cell
€œA1€ selected:

For line v(1,1)€¦
1. Range B2:D2 (composed of three merged cell ranges, B2:C2, B3:C4, D2:T4)
has a border put around it (a highlight to draw the users attention):
a. With Selection.Borders(xlEdgeLeft), (xlEdgeRight), (xlEdgeTop),
(xlEdgeBottom)
b. .LineStyle = xlContinuous
c. .Weight = xlThick
d. .ColorIndex = 41

2. When the user leaves the worksheet, or makes any click, or the workbook
is closed, the border is returned to
a. With Selection.Borders(xlEdgeLeft), (xlEdgeRight), (xlEdgeTop),
(xlEdgeBottom)
b. .LineStyle = xlContinuous
c. .Weight = xlThin
d. .ColorIndex = xlAutomatic

For line v(2,1)€¦
1. Range B12:D12 (composed of three merged cell ranges, B12:C12, B13:C14,
D12:T14) has a border put around it (a highlight to draw the users
attention):
a. Same as for v(1,1)€¦
b.
c.
d.
2. a. Same as for v(1,1)€¦
b.
c.
d.

For v(3,1)€¦
The same for each line €“ the only thing changing is the range name.
v(16,1)€¦


Option Explicit

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim v(1 To 16, 1 To 3) As String
Dim rng1 As Range
Dim i As Long

v(1, 1) = "C9": v(1, 2) = "Sheet3": v(1, 3) = "A1" €˜User clicks cell C9, is
moved to Sheet3, Cell A1
v(2, 1) = "C15": v(2, 2) = "Sheet3": v(2, 3) = "A1"
v(3, 1) = "C19": v(3, 2) = "Sheet3": v(3, 3) = "A1"
v(4, 1) = "C23": v(4, 2) = "Sheet3": v(4, 3) = "A1"
v(5, 1) = "C27": v(5, 2) = "Sheet3": v(5, 3) = "A1"
v(6, 1) = "C36": v(6, 2) = "Sheet3": v(6, 3) = "A1"
v(7, 1) = "H9": v(7, 2) = "Sheet4": v(7, 3) = "A1"
v(8, 1) = "H13": v(8, 2) = "Sheet4": v(8, 3) = "A1"
v(9, 1) = "H16": v(9, 2) = "Sheet4": v(9, 3) = "A1"
v(10, 1) = "H19": v(10, 2) = "Sheet4": v(10, 3) = "A1"
v(11, 1) = "H23": v(11, 2) = "Sheet4": v(11, 3) = "A1"
v(12, 1) = "H30": v(12, 2) = "Sheet4": v(12, 3) = "A1"
v(13, 1) = "M9": v(13, 2) = "Sheet5": v(13, 3) = "A1"
v(14, 1) = "M12": v(14, 2) = "Sheet5": v(14, 3) = "A1"
v(15, 1) = "M21": v(15, 2) = "Sheet5": v(15, 3) = "A1"
v(16, 1) = "M25": v(16, 2) = "Sheet5": v(16, 3) = "A1"

For i = 1 To 16
If Target.Address = Range(v(i, 1)).MergeArea.Address Then

Application.ScreenUpdating = False
Set rng1 = Sheets(v(i, 2)).Range(v(i, 3))
Sheets(v(i, 2)).Select
ActiveWindow.Zoom = 80
ActiveWindow.ScrollRow = rng1.Row
ActiveWindow.ScrollColumn = rng1.Column
Application.ScreenUpdating = True

Exit For
End If

Next
End Sub

 
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
How do I insert borders in every cell in a column Steve Excel Discussion (Misc queries) 1 February 18th 10 11:23 PM
Modify default size of insert comment Esgrimidor New Users to Excel 6 July 21st 09 08:54 PM
Modify Code Richard Excel Worksheet Functions 0 March 13th 08 08:19 PM
How to modify callouts in the InsertPictureAutoShape in Excel cathead Excel Discussion (Misc queries) 1 August 8th 07 05:45 PM
insert row keeping borders Lise Excel Discussion (Misc queries) 1 May 6th 06 05:36 PM


All times are GMT +1. The time now is 05:42 PM.

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

About Us

"It's about Microsoft Excel"