View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Loop Through Highlighted Range

Hi
try using

with selection
..value=.value
end with

--
Regards
Frank Kabel
Frankfurt, Germany

ChrisR wrote:
am trying to write something that will allow me to select a range of
cells (mostly just within 1 column, but maybe hundreds of rows deep).
Then I want to loop through each cell in the selection and at each
cell perform "ActiveCell.FormulaR1C1 = ActiveCell.ValueI " to
basically activate the cell. I do this for fields of info pulled from
a Financial LAN where they come down as text. Use to have this
written in personal macro file, but hard drive crashed and dont
remember how I wrote it years ago.

Any help would be appreciated. Here is my non working attempt...

Sub Activate()

' Keyboard Shortcut: Ctrl+Shift+Z

Dim cell As Range
Dim myrange As Range

Range(ActiveSheet.Range).Name = "myrange"

For Each cell In Range("myrange")

ActiveCell.FormulaR1C1 = ActiveCell.Value
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Next cell

Selection.End(xlUp).Select
End Sub