Column Row question

Henry

Board Regular
Joined
Mar 7, 2002
Messages
180
Can you lock the Column Width and Row Height for non-adajcent areas.

I don't want Col A, F, and Z to change. Same with row 3,4,5,8.

Thanks
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi there

You could use an event macro perhaps:

Right click you sheet tab, left click View Code and paste in this code:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A:A,F:F,Z:Z").ColumnWidth = 10
Range("3:3,4:4,5:5,8:8").RowHeight = 22.5
End Sub

Not the best answer but it will work

Regards
Derek
 
Upvote 0
Hi:

Thanks. Does this allow me to set ColA at one width and and Col C at another, and Col L at another?

MT
 
Upvote 0
If you want each column a different width you would have to change the code to reflect that, eg

Range("A:A").ColumnWidth = 10
Range("F:F").ColumnWidth = 15

etc etc

regards
Derek
 
Upvote 0
Derek:

I inserted the code exactly as you provided and saved the .xls. But,when I go back to the .xls, I can still manually change the Column widths, which is what I don't want to do. If I can do it, the customer can also do it.

Suggestions!
 
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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