Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Replace Column Letter only

I looking for a macro which would replace only the column letter in a
cell containing formula as at time there may me problem when cell
formula have letters which refer to sheet name.
Have tried the macro but it does not work - can anybody help or propose
an alternative.
Thxs


Sub Replacecolumnletter()
Dim c As Range
Dim Frm As String
Dim pos As Long
Dim Replacefrom
rng = InputBox("Letter to be replaced.")
Dim Replaceto
rng = InputBox("Letter to replace to.")


For Each c In Selection
pos = 1
Frm = c.Formula
Do Until pos = 0
pos = InStr(pos, Frm, Replacefrom
Select Case Mid(Frm, pos + 1, 1)
Case 0 To 9, "$"
Frm = Left(Frm, pos - 1) & Replace(Frm, Replacefrom,Replaceto,
pos, 1)
pos = pos + 1
End Select
Loop
c.Formula = Frm
Next c
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
Letter Replace Help!! James8309 Excel Worksheet Functions 3 July 20th 08 10:59 AM
How to replace column letter in refferences with a function using the old column letter? Dmitry Kopnichev Links and Linking in Excel 6 October 13th 05 09:09 AM
How to replace column letter in refferences with a function using the old column letter? Dmitry Kopnichev Excel Worksheet Functions 6 October 13th 05 09:09 AM
column header changed from letter to number, how return to letter Ron Excel Discussion (Misc queries) 2 May 9th 05 08:34 PM
Replace Letter "E" with Letter "C" for 200 Different Sums in a Col Katherine Excel Worksheet Functions 1 January 21st 05 02:53 AM


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