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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

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!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,944
Messages
5,856,446
Members
431,814
Latest member
Oriel Tzvi Shaer

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