Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to freeze cols up to extent of data in col Q

Cols R and U contain formulas till row 200. I need a sub to freeze cols R and
U from row 4 to the last row of data in col Q (taken from bottom up). Col Q
contains only data, no formulas. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Sub to freeze cols up to extent of data in col Q

Max, try the below in activesheet

Sub Macro()
Dim lngRow As Long


lngRow = Cells(Rows.Count, "Q").End(xlUp).Row
Cells.Locked = False
Range("Q4:R" & lngRow).Locked = True
ActiveSheet.Protect Password:="password"
End Sub

--
Jacob (MVP - Excel)


"Max" wrote:

Cols R and U contain formulas till row 200. I need a sub to freeze cols R and
U from row 4 to the last row of data in col Q (taken from bottom up). Col Q
contains only data, no formulas. Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to freeze cols up to extent of data in col Q

Sorry, what I meant by "freeze" was to convert the formulas in cols R and U
to values (copy paste special as values). What should be changed in the sub
to do that? Thanks
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Sub to freeze cols up to extent of data in col Q

Try

Columns("R") = columns("R").value
Columns("U") = columns("U").value

--
Jacob (MVP - Excel)


"Max" wrote:

Sorry, what I meant by "freeze" was to convert the formulas in cols R and U
to values (copy paste special as values). What should be changed in the sub
to do that? Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to freeze cols up to extent of data in col Q

Thanks, but I'm not sure how to adapt those lines to suit the desired
"freeze" extent, ie only from row 4 down to the last row of data in col Q,
not the entire col. Grateful if you could take a moment to piece it together


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Sub to freeze cols up to extent of data in col Q

OK. Try the below

Sub Macro()
Dim lngRow As Long

lngRow = Cells(Rows.Count, "Q").End(xlUp).Row

Range("R4:R" & lngRow) = Range("R4:R" & lngRow).Value
Range("U4:U" & lngRow) = Range("U4:U" & lngRow).Value

End Sub


--
Jacob (MVP - Excel)


"Max" wrote:

Thanks, but I'm not sure how to adapt those lines to suit the desired
"freeze" extent, ie only from row 4 down to the last row of data in col Q,
not the entire col. Grateful if you could take a moment to piece it together

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enhance sub to copy cols of variable length into 1 col to snake results into other cols Max Excel Programming 1 August 7th 08 02:03 PM
2 Cols To 2 Cols VLookup Comparison CuriousMe Excel Discussion (Misc queries) 4 December 21st 06 07:54 PM
Range.Select 1st pass 13 cols, 2nd paqss 25 cols twice as wide in error? Craigm[_53_] Excel Programming 2 May 2nd 06 11:04 AM
Cond Format:re color 2 cols, skip 2 cols Tat Excel Worksheet Functions 2 June 22nd 05 06:43 PM
Improvement to sub: Detect data extent and convert to values Max Excel Programming 5 July 14th 04 03:18 PM


All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"