LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Offset.Value

Guess I missunderstood and thought there were only dots in the source
range - that answers why Dave spent time counting them.

--
Regards,
Tom Ogilvy

"John" wrote in message
...
Hi Tom,

Thanks for your second reply today!

Yes, I see what you mean about the dots, however as I read it, however, I
only want to indent the items in column B. The other values in the

"dotted"
string are not required.

Anyway, thanks again and I will certainly use the Replace function in
future.

Best regards

John

"Tom Ogilvy" wrote in message
...
Or you could skip counting the dots and let them represent themselves.

Option Explicit

Sub IndentListWithSpaces()

'Run down list and indent cell values to right,
'dependent on number of dots in string

Dim rgListItem As Range
Dim r As Integer
Dim c As Integer
Dim Answer As Long

'Check user selects cell at top of list
Answer = MsgBox(Prompt:="Is cell at top of list selected?", _
Buttons:=vbYesNo + vbQuestion)
If Answer = vbNo Then Exit Sub

r = ActiveCell.Row
c = ActiveCell.Column

Do
Set rgListItem = Cells(r, c)
If IsEmpty(Cells(r, c)) Then Exit Do
With rgListItem.Offset(0, 1)
.Value = Replace(rgListItem.Text,"."," ") & .Value
' or for xl97
' .Value = Application _
' .Substitute(rgListItem.Text,"."," ") & .Value
End With
r = r + 1
Loop

Cells(r, c).Select

MsgBox "Finished"

End Sub

--
Regards,
Tom Ogilvy










 
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
OFFSET Jose Mourinho Excel Worksheet Functions 1 December 23rd 09 01:26 PM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
offset Eva Excel Worksheet Functions 2 January 29th 07 08:45 PM
OFFSET HELP Scott@CW Excel Worksheet Functions 1 December 21st 06 04:27 AM
SUM() and OFFSET() CAUSES #VALUE [email protected] Excel Worksheet Functions 7 September 13th 06 02:46 AM


All times are GMT +1. The time now is 09:34 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"