Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2014, 04:09 AM
dave8555 dave8555 is offline Search and replace/insert HTML code into Master File using tags Windows 7 64bit Search and replace/insert HTML code into Master File using tags Office 2007
Novice
Search and replace/insert HTML code into Master File using tags
 
Join Date: Feb 2014
Posts: 1
dave8555 is on a distinguished road
Default Search and replace/insert HTML code into Master File using tags

Hello



I need ideally a formula that can do the following;


Example of the cell A3 tag 1FINDandREPLACE


Step 1: Look within a specified cell (i.e cell A3) and copy the tag in that cell.
Step 2: Search within cell B2 (B2 contains various text that includes the tags).
The tag in cell B2 is then to be replaced with the content from cell B3.

Step 3: Repeat steps 1 & 2 for tags A3 to A9 and MASTER HTML FILE B1 to L1 and more


This is a simple idea, but unfortunately I have not been able to find the code already in the forums that can do this task?


Attached is the problem in the excel file.


I look forward to your suggested formula, or if a formula is not possible, a macro could be used and any suggestions on the macro code would be helpful.


Kind Regards
David
Attached Files
File Type: xlsx example.xlsx (16.8 KB, 2 views)
Reply With Quote
  #2  
Old 02-23-2014, 07:15 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Search and replace/insert HTML code into Master File using tags Windows 7 64bit Search and replace/insert HTML code into Master File using tags Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,479
Pecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to beholdPecoflyer is a splendid one to behold
Default

Cross post http://www.excelguru.ca/forums/showt...ed=1#post11600
Reply With Quote
  #3  
Old 02-23-2014, 03:51 PM
macropod's Avatar
macropod macropod is offline Search and replace/insert HTML code into Master File using tags Windows 7 32bit Search and replace/insert HTML code into Master File using tags Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,215
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

I'd be inclined to use a macro:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim LRow As Long, LCol As Long, cCol As Long, cRow As Long
Dim StrTmp As String, StrFnd As String, StrRep As String
With ActiveSheet
  LRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
  LCol = .Cells.SpecialCells(xlCellTypeLastCell).Column
  For cCol = 2 To LCol
    StrTmp = .Cells(2, cCol).Value
    For cRow = 3 To LRow
      If Trim(.Cells(cRow, 1).Value) = "" Then Exit For
      StrFnd = .Cells(cRow, 1).Value
      StrRep = .Cells(cRow, cCol).Value
      StrTmp = Replace(StrTmp, StrFnd, StrRep)
    Next
    .Cells(LRow + 2, cCol).Value = StrTmp
  Next
End With
Application.ScreenUpdating = True
End Sub
As coded, the macro outputs the modified data two rows below whatever the current last row is.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and replace/insert HTML code into Master File using tags Generate sequential code tags ssarank Word VBA 3 12-25-2013 02:44 AM
How to use Find and Replace with HTML tags? srz92 Word 0 07-17-2013 07:55 AM
Search and replace/insert HTML code into Master File using tags Trying to wrap HTML tags around multiple different words in one operation String Word VBA 4 06-06-2013 06:23 AM
Attaching MSG file is stripped on send and HTML tags show on previewing prior to send Fantastic4 Outlook 0 01-09-2012 12:18 PM
Search and replace/insert HTML code into Master File using tags For Moderator: Code tags? Ulodesk Forum Support 1 07-12-2011 07:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft