VBA Highlight Column & Row with Border Based on Selection

pure vito

Board Regular
Joined
Oct 7, 2021
Messages
183
Office Version
  1. 365
Platform
  1. Windows
Hi All 🖐️

I'm here looking for suggestions today and hopefully help, below is an image of my document the user fills H2:M... the issue I'm having is that it's very difficult to tell if your inputting into the correct cell,

I looked into using a VBA that highlights the selected column and row with colour but it basically removes all current colour this isn't really an option, In the image I have used a thick border to create a line do you think its at all possible to have this act in the same way as the VBA highlighter but with borders? 🤔


1675929239535.png
 
Hi @HaHoBe

I've come across an issue I think is tied to the macro you provided, while the macro is active I am unable to use Undo do you have any ideas or suggestions please 🙏

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim rngWork As Range

Const clngZoom As Long = 30

Set rngWork = Range("H2:M133")

With rngWork
  .RowHeight = 12   'change to suit
  .ColumnWidth = 5  'change to suit
End With

If Target.Count = 1 Then
  If Not Intersect(Target, rngWork) Is Nothing Then
    Target.EntireRow.RowHeight = clngZoom
    Target.EntireColumn.ColumnWidth = clngZoom
  End If
End If

Set rngWork = Nothing
End Sub
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Thank You Holger,

Considering I've only just noticed this now implies I don't really need the undo feature and I would rather keep this macro working so I'll probably just leave as is then if it's a complex task to get both the macro and the undo working at the same time, thanks for your assistance Holger (y)
 
Upvote 0
Hi @HaHoBe

I've come across an issue I think is tied to the macro you provided, while the macro is active I am unable to use Undo do you have any ideas or suggestions please 🙏
The post 9 suggestions preserves the Undo feature. Did you try it?
 
Upvote 0
Hey Peter, thank you 🙏 your suggested method does seem like the ideal and preserving the undo feature really would be great, but I really like how this vba works in resizing the rows and columns it's perfect for what I'm trying to achieve visually even without a solution using this vba and preserving the undo feature I'm still happy to use it as is, the end user will only have to type numbers in a small range so I feel like I can live without it for now Thanks again Peter (y)
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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