Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replacing part of a cell text


Hi there!

I'm working on a macro to automate my project, One thing i need to do
now is to replace the numerals in a cell from another cell. For
example, in sheet1 C2, i have this numeral 20. I will like this macro
to replace sheet3 C2 which contains data such as 11. I want the numeral
11 to be replaced by 20. Hope someone can help with this!

Another thing is how do i call from excel macro to ask notepad to open
up a .xml file?

Thanks a lot!


--
oOpsy
------------------------------------------------------------------------
oOpsy's Profile: http://www.excelforum.com/member.php...o&userid=29132
View this thread: http://www.excelforum.com/showthread...hreadid=489705

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Replacing part of a cell text

not knowing how much you have to do, this will solve your example

Worksheets("sheet3").Range("c2").Value = Worksheets("Sheet1").Range("c2")

--


Gary


"oOpsy" wrote in
message ...

Hi there!

I'm working on a macro to automate my project, One thing i need to do
now is to replace the numerals in a cell from another cell. For
example, in sheet1 C2, i have this numeral 20. I will like this macro
to replace sheet3 C2 which contains data such as 11. I want the numeral
11 to be replaced by 20. Hope someone can help with this!

Another thing is how do i call from excel macro to ask notepad to open
up a .xml file?

Thanks a lot!


--
oOpsy
------------------------------------------------------------------------
oOpsy's Profile:
http://www.excelforum.com/member.php...o&userid=29132
View this thread: http://www.excelforum.com/showthread...hreadid=489705



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replacing part of a cell text


Hi Gary!

Thanks for the code. But sorry that i left out something impt! In
sheet3, C2, i have data such as <val11</val. I want to replace just
the numeral 11 from the numeral 20 which i copy from Sheet 1 C2. Is
that possible? So that in the end, sheet3 C2 will display as
<val20</val

Thanks!


--
oOpsy
------------------------------------------------------------------------
oOpsy's Profile: http://www.excelforum.com/member.php...o&userid=29132
View this thread: http://www.excelforum.com/showthread...hreadid=489705

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Replacing part of a cell text

try this

Sub test2()
Worksheets("sheet3").Range("c2").Value = _
Replace(Worksheets("sheet3").Range("c2"), "11", _
Worksheets("sheet1").Range("c2").Value)
End Sub


--


Gary


"oOpsy" wrote in
message ...

Hi Gary!

Thanks for the code. But sorry that i left out something impt! In
sheet3, C2, i have data such as <val11</val. I want to replace just
the numeral 11 from the numeral 20 which i copy from Sheet 1 C2. Is
that possible? So that in the end, sheet3 C2 will display as
<val20</val

Thanks!


--
oOpsy
------------------------------------------------------------------------
oOpsy's Profile:
http://www.excelforum.com/member.php...o&userid=29132
View this thread: http://www.excelforum.com/showthread...hreadid=489705



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Replacing part of a cell text

or, if the 11 can be any 2 digit number:

Sub test3()
Worksheets("sheet3").Range("c2").Value = _
Replace(Worksheets("sheet3").Range("c2"), _
Mid(Worksheets("sheet3").Range("c2"), 6, 2), _
Worksheets("sheet1").Range("c2").Value)
End Sub

--


Gary


"oOpsy" wrote in
message ...

Hi Gary!

Thanks for the code. But sorry that i left out something impt! In
sheet3, C2, i have data such as <val11</val. I want to replace just
the numeral 11 from the numeral 20 which i copy from Sheet 1 C2. Is
that possible? So that in the end, sheet3 C2 will display as
<val20</val

Thanks!


--
oOpsy
------------------------------------------------------------------------
oOpsy's Profile:
http://www.excelforum.com/member.php...o&userid=29132
View this thread: http://www.excelforum.com/showthread...hreadid=489705





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replacing part of a cell text


Thanks a lot gary! the 2nd code did the trick;)


--
oOpsy
------------------------------------------------------------------------
oOpsy's Profile: http://www.excelforum.com/member.php...o&userid=29132
View this thread: http://www.excelforum.com/showthread...hreadid=489705

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
Replacing text in a cell with blanks Tom Excel Discussion (Misc queries) 3 May 10th 09 06:02 PM
Replacing Part of a Cell's Content mommy2kh Excel Worksheet Functions 5 July 13th 08 05:42 PM
Replacing part of a (too) long formula AB3 Excel Discussion (Misc queries) 5 June 3rd 08 10:35 AM
replacing text in a cell Roger Converse[_2_] Excel Discussion (Misc queries) 4 December 7th 07 07:50 PM
Replacing Text in a Cell Reference pdberger Excel Programming 1 November 28th 05 07:50 PM


All times are GMT +1. The time now is 08:13 PM.

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"