Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Andibevan
 
Posts: n/a
Default 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   Report Post  
Andibevan
 
Posts: n/a
Default

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
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
How do I copy cell values (derived from formula), not references? Matt in a spot of bother Excel Worksheet Functions 4 July 28th 05 08:09 AM
column values to a cell with comma seperated Raju Boine. Excel Worksheet Functions 3 July 27th 05 03:30 PM
VLookup to sum cell values Zakynthos Excel Worksheet Functions 4 July 26th 05 12:05 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
how can i automatically insert cell values into a comment field? spot987654321 Excel Discussion (Misc queries) 1 June 3rd 05 11:10 PM


All times are GMT +1. The time now is 12:04 AM.

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

About Us

"It's about Microsoft Excel"