vba regulate row height

john_cash

New Member
Joined
Jul 30, 2019
Messages
23
Hello,
in a workbook it is possible to adjust the height of the rows only if clicked
in the cells of column C / F / G not selecting the whole row?
I hope I explained myself
john
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
You can't adjust height of individual cells !
When a cell height is adjusted the whole row is affected.
 
Upvote 0
Hi Michael.
I have a macro
Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)


   If Not Intersect(Target, Range("C:C, F:F, G:G")) Is Nothing Then
       ActiveSheet.Unprotect "987654"
        ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
       , AllowFormattingRows:=True, AllowFormattingCells:=True, AllowFiltering:=True
   Else
        ActiveSheet.Unprotect "987654"
        ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
      , AllowFormattingRows:=False, AllowFormattingCells:=False, AllowFiltering:=True
    End If
    
   End Sub

this macro only in the cells of the columns C/F/G
you can change the text size, in the other columns you can only write

This macro works in this range A1: I200
What I ask is a change:
only by clicking in the cells ol column C/F/G is it possible to adjust the height of the rows Selection.Rows.AutoFit



Or create this macro:
select a column cell C/F/G > Selection.Rows.AutoFit
if it is a different cell notice you cannot adjust


I hope I explained myself
john
 
Upvote 0
A help for this?

select a column cell C/F/G > Selection.Rows.AutoFit
if it is a different cell notice you cannot adjust

john
 
Upvote 0
Maybe this

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
   If Not Intersect(Target, Range("C:C, F:F, G:G")) Is Nothing Then
       ActiveSheet.Unprotect "987654"
        ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
       , AllowFormattingRows:=True, AllowFormattingCells:=True, AllowFiltering:=True
        [color=red]ActiveCell.EntireRow.AutoFit[/color]
   Else
        ActiveSheet.Unprotect "987654"
        ActiveSheet.Protect Password:="987654", DrawingObjects:=True, Contents:=True, Scenarios:=True _
      , AllowFormattingRows:=False, AllowFormattingCells:=False, AllowFiltering:=True
    End If
 End Sub
 
Upvote 0
Hi Michael,
I think it is not accurate to insert the functionin ActiveCell.EntireRow.AutoFit in the macro that I insert
hould only work if I click in a cell
Must be 2 separate macros
 
Upvote 0

Forum statistics

Threads
1,214,577
Messages
6,120,359
Members
448,956
Latest member
Adamsxl

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