Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Faster Way of looping through cell values
Hi All,
Is there a faster way of achieving the following loop:- It checks through the range and ensures the last value in each cell is a hard carriage return. It does not act on blank cells. Sub add_hard_carriage() Dim start_r As Integer, last_r As Integer Dim const_Range As Range Dim wsNM As Worksheet Dim CurCell As Object 'As Range Dim var_Chk As Integer Set wsNM = Sheets("Project Log Form") start_r = 9 'Start Row on data sheet last_r = wsNM.Range("A65536").End(xlUp).Row 'last row Set const_Range = wsNM.Range("T" & start_r & ":T" & last_r) 'Range containing information 'Column A = Sheet, B = Range 'MsgBox (const_Range.Address) For Each CurCell In const_Range If CurCell.Value < "" Then var_Chk = Asc(Right(CurCell, 1)) If var_Chk < 10 Then CurCell.Value = CurCell.Value & Chr(10) End If End If Next CurCell End Sub |
#2
|
|||
|
|||
Apologies - inadvertantly posted in incorrect group.
"Andibevan" wrote in message ... Hi All, Is there a faster way of achieving the following loop:- It checks through the range and ensures the last value in each cell is a hard carriage return. It does not act on blank cells. Sub add_hard_carriage() Dim start_r As Integer, last_r As Integer Dim const_Range As Range Dim wsNM As Worksheet Dim CurCell As Object 'As Range Dim var_Chk As Integer Set wsNM = Sheets("Project Log Form") start_r = 9 'Start Row on data sheet last_r = wsNM.Range("A65536").End(xlUp).Row 'last row Set const_Range = wsNM.Range("T" & start_r & ":T" & last_r) 'Range containing information 'Column A = Sheet, B = Range 'MsgBox (const_Range.Address) For Each CurCell In const_Range If CurCell.Value < "" Then var_Chk = Asc(Right(CurCell, 1)) If var_Chk < 10 Then CurCell.Value = CurCell.Value & Chr(10) End If End If Next CurCell End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I copy cell values (derived from formula), not references? | Excel Worksheet Functions | |||
column values to a cell with comma seperated | Excel Worksheet Functions | |||
VLookup to sum cell values | Excel Worksheet Functions | |||
Possible Lookup Table | Excel Worksheet Functions | |||
how can i automatically insert cell values into a comment field? | Excel Discussion (Misc queries) |