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
 

Some videos you may like

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Derek

Well-known Member
Joined
Feb 16, 2002
Messages
1,592
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
 

Henry

Board Regular
Joined
Mar 7, 2002
Messages
180
Hi:

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

MT
 

Derek

Well-known Member
Joined
Feb 16, 2002
Messages
1,592
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
 

Henry

Board Regular
Joined
Mar 7, 2002
Messages
180
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!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,494
Messages
5,602,004
Members
414,490
Latest member
Rip181

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
Top