LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default replace apostrophe with values above

One way:

If the characters in the cells are truly two single quotes, try this:

Dim lX As Long
Dim rCell As Range
For Each rCell In ActiveSheet.UsedRange.Columns(1).Rows
If rCell.FormulaR1C1 = "''" Then
rCell.Value = rCell.Offset(-1, 0).Value
rCell.Offset(0, 1).Value = rCell.Offset(-1, 1).Value
End If
Next rCell

If the characters are actually double quotes, try this:

Dim lX As Long
Dim rCell As Range
For Each rCell In ActiveSheet.UsedRange.Columns(1).Rows
'If rCell.FormulaR1C1 = """" Then MsgBox "got it " & rCell.Address
If rCell.FormulaR1C1 = "''" Then
rCell.Value = rCell.Offset(-1, 0).Value
rCell.Offset(0, 1).Value = rCell.Offset(-1, 1).Value
End If
Next rCell

HTH

"Koen" wrote:

Hi, I'm looking for a solution for the following problem:
I have data in more or less the following form:

A B
1/1/08 Alex
" "
" "
13/1/08 Sarah
" "
" "

The apostrophes meaning that this cell has the same entry as the one above

So what I want to have is my data in the following form:

A B
1/1/08 Alex
1/1/08 Alex
1/1/08 Alex
13/1/08 Sarah
13/1/08 Sarah
13/1/08 Sarah


I used the code like in the following thread:

http://www.microsoft.com/communities...=en-us&m=1&p=1

It works fine for all symboles except for the apostrophe, because it has
some sort of function in VBA (don't know, because I cannot program in VBA)

Can anyone help me, or do I have to use a different symbol?

Thanks in advance,

Koen

 
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
VBA Find and Replace isn't working on apostrophe within cell value Jon[_18_] Excel Programming 2 June 22nd 07 04:10 PM
Find/Replace Unshown Apostrophe ajvasel Excel Programming 2 March 6th 07 05:47 PM
Replace all values in a column with values using a mapping from another worksheet [email protected] Excel Programming 6 August 18th 06 03:12 PM
FIND and REPLACE ' apostrophe James T Excel Discussion (Misc queries) 3 June 9th 06 06:55 AM
Remove the apostrophe (') in Excel cell text values Connull Excel Discussion (Misc queries) 5 January 11th 05 05:06 PM


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