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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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