Excel 2010 :: VBA Routine To Perform Text Diff

Jul 19, 2013

I am looking to implement the "Compare Documents" function (available in Word 2010) in Excel 2010 through VBA programming between different text contained in two cells.

In Word this function works quite well (not perfectly), but it highlights in different ways which part has been deleted and which one has been added between an "original" document and a "revised" one.

For the nature of my job, I need to do this on a daily basis and I used to output text from Excel to Word, then compare the two text, and then copy it back to Excel.

Here comes the problem: since in Word the text is formatted (and what I'm looking for is formatted/highlighted text as output), I can't just paste it in Excel as it is: any editing, merging, splitting done on the pasted text (that eventually I need to do) makes the formatting disappear (above all with VBA functions, that can only output data and can't format it).

In other words: given two cells containing different text, I would like to be able to fill a third cell with text formatted accordingly to the TextDiff output between the two original cell.

E.g.:
INPUT:
Cells(1,1).Value2 = "my name is Andrea and I like jogging" (original)
Cells(1,2).Value2 = "my name is Giovanni and I like running" (revised)

OUTPUT:
Cells(1,3) wll contain: "my name is AndreaGiovanni and I like joggingrunning"

Obviously, since UDF doesn't allow formatting of cells, I would need to adjust the main Sub for each pair of document I have to revise, but that won't be the problem: what I need is the engine. It's been two years and a half that I do advanced VBA programming at work but it looks like I can't grasp the rationale behind the LCS algorithm.

View 9 Replies


ADVERTISEMENT

Can Worksheet_Change Routine Perform Actions On Different Worksheet

Sep 26, 2013

I'm using a Private Sub Worksheet_Change(ByVal target As Range) macro on Worksheets(2) to perform certain actions when a selection from Worksheets(1) is pasted to Worksheets(2). Before ending the Worksheet_Change sub I'd like it to deselect the copied selection on Worksheets(1). I've tried to do this by selecting Worksheets(1) and moving the cursor, but VB ignores the "With Application.Worksheets(1)" instruction. Removing "Private" from the sub heading makes no difference.

Is it possible do this with a Worksheet_Change routine? If so, how?

View 7 Replies View Related

Excel 2010 :: Error Handling Routine Which Stores Name Of File

Jun 3, 2014

I have written a VBA procedure which loops through excel files in an array: in turn it opens the file, refreshes the data, saves the file and closes. I would like to write an error handler which stores the file which errored (copied from the loop iteration) and the error description to an array. The error handler should then close the file and continue with the next iteration - e.g.

Code:
If ActiveWorkbook.ReadOnly Then
ActiveWorkbook.Close
Next i
*Although a generic if error may be better.

My idea is that all files which errored in some way will be stored in an array which I can automatically print/send to a user so they can manually figure out the problem. (This element falls outside the range of this query).

Below is a simple example of my efforts which only contains one file in the array to make things simpler: the error handler section won't work, it's just there to show my thinking

Code:
Sub Refresh_CRIS()
On Error GoTo Errorhandler
Dim routepath As String
routepath = "
chdfsSharedAreaPrivateTest"
ChDir routepath

[Code] ........

Errorhandler:
On Error Resume Next
Failed = Array(i)
If ActiveWorkbook.ReadOnly Then 'Just an example for testing
ActiveWorkbook.Close
Else
MsgBox "Pivots which failed to refresh:" & Failed '& ", ", 0, "Debug" 'Test with msgbox
End If
End Sub

Using Excel 2010

View 5 Replies View Related

Excel 2010 :: Color Fill And Font Reset Macro Routine?

Aug 12, 2012

In Excel 2010, you can color a cell with a fill color and a font color.

It can be done manually via one of 3 methods that I know of (aside from a macro or a routine):

-From the ribbon button (underneath the font size and increase and decrease font size toolbar buttons)

-By formatting the cell (right clicking on a cell),

-Clicking on the ribbon's font section (giving you the same 6 category format cell box as right clicking on a cell)

What I need is a routine that resets the Fill Color and Font Color toolbar buttons to "No Fill" and "Automatic" if I run it inside a macro or create a command button on a worksheet.

View 4 Replies View Related

Excel 2010 :: Worksheet With Vba To Perform FFT Beyond 4096 Limit

Feb 21, 2014

where to find a spreadsheet which has a macro to perform the FFT on data with > 4096 points? It seems Excel's internal FFT is limited to this amount. I searched the forum and elsewhere on web and have not found what I am looking for. I wish to enter the data in a column of the spreadsheet, preferably in a named range such as "Data" and have a macro perform the FFT.

View 3 Replies View Related

Excel 2010 :: Perform Sum Based On Other Cells Content?

Jan 31, 2013

Exel 2010 cells formatted to Time

need to look at h1 and h2 if no data ignore

other wise add data together if total exceeds 08:45

then deduct 45min from h1

if combined the are less than 8:45 then h3 must equal 8:00 by altering h1 only

Example

h1= 5:00
h2= 2:00
h3= 8:00

h1=
h2=
h3=

h1= 8:00
h2= 2:00
h3= 7:15

View 3 Replies View Related

Excel 2010 :: Macro To Perform Find And Replace Function

Apr 8, 2014

I have two sheets. One is named sheet1 where all my data is and sheet2 where all my values are. I want to do a find a replace on column N (sheet1) using the data in sheet2. Column A on Sheet2 has all the values that are found in column N and column B on Sheet2 has what the data should change to.

So for example:

Sheet1 says the following on column N:
cat
dog
lion
bear

Sheet2 says:
Column A
A1: Cat
A2: Dog
A3: Bear

Column B
B1: 2
B2: 8
B3:15

I want the values on column N to be replaced with 2, 8, 15 and so forth. I use excel 2010.

View 1 Replies View Related

Project Routine List: Printout Of Each Routine Name And Which Module It Resides In

Feb 22, 2007

I am in the process of re-building a major project due to bugs. In the process, I plan to re-organize my sub-routine grouping within modules. In the source file, I have 18 standard modules, with 10-30 routines in each one.

What I would like is a printout of each routine name and which module it resides in, so I can check off each one as I copy it and paste it into the new file. I see that I can get a psuedo tree-view of my project in th eObject Browser, but can't figure out how to print that.

View 9 Replies View Related

Excel 2010 :: Macro For Replacing Text In HTM Document - Text To Change Different Every Time

Mar 18, 2014

I am my excel worksheet (excel 2010) I have one cell that changes every day (number). I want this number to open my htm document and replace the same number in a string in the htm and save/close this.

An example:
My htm document is located at C:/ and named XX.htm

The number I want from excel is in cell A1 in sheet1, and the worksheet is located in D:/ named yy.xlsx

And the text(number) I want to replace is in the following string in the htm document, in this string it is 72, next day it can be 30:

src="Bilder/72.png"

View 8 Replies View Related

Can A Cell Contain Text And Perform Calculation?

Nov 17, 2009

I would like to have a cell in which there is descriptive text and the results of a calculation. For example, in row 2, I want to state the current total number of items in inventory at the top of the sheet in the center of the used cells.

Inventory Total is: SUM(A4:A64,000) as of: Date()

I can't merge cells or manipulate the text in such a way to neatly bring the text and calculation together. And there are actually 2 calculations in the example above. One to SUM the items and one to add the date.

View 5 Replies View Related

Excel 2007 :: VBA - Finding Endless Loop In Long Routine?

May 14, 2014

I have a very long routine, looping through 35,000-ish rows several times to detect and delete unwanted items. Occasionally, it gets locked into an endless loop and CTRL+Break will not stop it - I have to kill Excel through the Task Manager.

How can I find out where the endless loop is so I can detect what's causingit and fix it?

View 6 Replies View Related

Conditional Copy Routine: Macro To Search A Column For A Specific Text String

Oct 5, 2009

I am trying to write a macro to search a column for a specific text string which when found, will copy the whole row the string is in. Once this row has been copied, I then want the macro to activate a new sheet and search for the next available empty row to paste the data. Once this has been done, go back to the original sheet and find the next cell in the original column with the specified text string and repeat until the range has been satisfied. Below is the script I have that sort of works.

View 5 Replies View Related

Perform Same Task To Multiple Worksheets That Contain Text Parameter

Jun 21, 2014

I am trying to do the following: I want to replace the values in A1:A3 with "0" and clear the contents of B1:B3 for all worksheets that contain "ILA" in the worksheet name. Is there a simple way to do this or another thread that already answers this question? I tried to search on the internet but found nothing useful. Here is a sample file (NOTE: there are no macros in this workbook even though it is saved as an .xlsm).

Clear and replace macro on multiple tabs.xlsm

View 5 Replies View Related

Excel 2010 :: How To Put Number As Text

Sep 13, 2013

I need to put a number as a text. It is 14 digits long (35071245130000). If I change it from a number to a text, it re-formats to a scientific number (3.50712E+6).

I can not use the ' in front of the number because it makes all of my vlookups mess up.

The reason I need this changed is because I have a several databases/excel spreadsheets that are being linked through Access. The number is stored as text in the other databases. Because of this, the spreadsheet with the number is not recognizing the number version and the text version as the same.

How to make excel show this full number when formatted as text?

I have Excel 2010. I do not remember having this problem with other versions at my previous employer.

View 2 Replies View Related

Perform Large Multi Search In Excel?

Mar 20, 2014

I have some product SKU's in Exel all in the same column and all unique. The problem is I have been building a product database for my website and only just noticed that the CSV file my distribution company supplied me with didn't include the product description. Since then the distribution company has added a description field to the feed, however the company has added products within this time so it's not as if I can copy and paste the description field into my product database as the wrong descriptions will match with the wrong products. Is there any way I can highlight all of my sku's and the rows they are in? This would work a treat as I could just select all of my SKU's in my product database and then find those products only in the CSV file the company has supplied me with.

View 12 Replies View Related

How Do I Perform An Array Multiplication If A Cell Contains A Specific Text String?

Feb 17, 2009

Sum every instance of [SPREAD]*[SIZE] where [NAME] occurs within a text string.

Please note, I'm trying to do this without creating a new column [SPREAD]*[SIZE].

View 11 Replies View Related

Excel 2010 :: Breaking Out Numbers Out Of Text?

Jan 13, 2013

I have this text at J22 and i would like to break out 13 and 95 000 out of this:

<td><span>13</span></td><td class=""right_align""><span>0-0-2</span></td><td class=""right_align""><span>95 000

The numbers and lenght of the numbers where 13 and 95 000 are may vary in lenght. I need them to parse the values at those spots to separate cells.

Im using excel 2010

View 12 Replies View Related

Excel 2010 :: Date Sometimes Changed Into Text

Mar 11, 2014

When I combine 3 reports (which we get out of a system) into 1 big file, the date format remains the same (mm/dd/yyyy and right alligned). Same happens for most of my colleagues.

When 1 particular colleague goes and combine these reports, I've noticed that some of the dates are showing as text? (dd/mm/yyyy and left alligned).

View 3 Replies View Related

Excel 2010 :: Get Cursor Position In A Text Box

Mar 29, 2014

I'm in a text box in Excel 2010. I need to find the current cursor position in the line of text in the box - using VBA.

View 2 Replies View Related

Excel 2010 :: Numbered Stored As Text?

Dec 6, 2011

I received one excel spreadsheet office 2010 every week from one on the vendor. it has over 55000 rows. I got columns N, O, P & Q. these columns has some value which I use for my pivot tables. However the values in this columns are stores as a text. I select the little small box (information box ) appears on the right side of the cell and right click on that where I get an option to change it to number. This is working well.

However I have over 55000 rows , it takes a lot of times to change all these cells in four columns ( almost over 220,000 cells). some times more than an hours.

I use excel 2010.

View 3 Replies View Related

Excel 2010 :: How To Fix Cell Text Format

Dec 17, 2011

i am trying to work on a database that has some errors that i want to correct the issue is that some of the cells have data that is listed last, first instead it needs to be listed into first last.

I can not seperate this into 2 fields as it would break the program this database belongs to.

this database is linked from excell to access i am using excell to update an access database

i use office 2010

View 9 Replies View Related

Excel 2010 :: Text Contained In Formulas?

Feb 29, 2012

I am working in Excel 2010.

I am looking over spreadsheets in a new job, and I am coming across formulas I am unfamiliar with?

For example, =(G16*G17/C13-G24)*hrs and =I25*elec.

hrs and elec??

After using the "Trace Precedents" feature, the "hrs" and "elec" are still a mystery to me. Are these variables that the creator of the spreadsheet has defined? They don't appear to be named data sets because they exist in just a few cells.

View 3 Replies View Related

Excel 2010 :: Converting Text To Date?

Aug 20, 2013

i have the text as string data in column A and it is just a text not date format. i want to convert this using formula text function to get result shown in column B and C. is this doable?

Excel 2010ABC1DateRevised DateRevised Date 2Fri 4 Feb 2011Friday, February 04, 20112/4/20113Fri 5 Oct 20074Fri 28 Apr 20065Fri 30 Sep 20056Fri 23 May 20087Fri 3 Feb 20068Fri 30 Sep 20119Fri 11 May 200710Tue 1 Jan 201311Fri 13 Aug 201012Tue 25 Jun 201313Fri 8 Jun 201214Fri 25 Mar 201115Fri 12 Feb 201016Fri 5 Sep 200817Fri 6 Nov 200918Fri 6 Mar 200919Fri 21 Aug 200920Fri 6 Jan 201221Fri 5 Jan 200722Fri 15 Jan 201023Fri 12 Jun 200924Fri 7 Jul 200625Fri 21 Oct 201126Fri 31 Oct 2008Sheet4

View 5 Replies View Related

Excel 2007 :: Make Connection To SQL And Perform SELECT

Jun 2, 2014

Essentially all I want to do is create a procedure/function in Excel such as =SQLdata(3), where 3 could be customer ID and then the function would make a connection to SQL and perform the SELECT etc procedure and return the CustomerName in the cell with that formula.

I have excel 2007 and MS SQL where my data is stored. I understand that I need to make the connection to my SQL database, but I really do not know how to do this.

View 4 Replies View Related

Excel 2010 :: Replacing Part Of The Text In A Cell

Jun 1, 2014

I'm running Excel 2010.

In a field containing this: Bergamot, Orange*(11,16) I want to put a space before the asterisk. There are hundreds of these in the spreadsheet with other text before and after the text to be replaced. I made sure the field is defined as a text field.

I searched on "*(" and said replaced with " *(" and ended up with " *(11,16)" - the Bergamot, Orange was removed from the field.

View 6 Replies View Related

Excel 2010 :: How To Combine A Formula And Text In Same Cell

Jun 20, 2014

How do I combine a formula and text in the same cell in excel 2010.

What I am looking for is the sum of a number of cells, followed by text.

e.g. something like =SUM(E4:E50)"/35"

If the sum result of cells E4:E50 was 10, I would be expecting to see visible in the cell '10/35'

How do I write this formula?

View 3 Replies View Related

Excel 2010 :: Condition Formatting On Column Of Text?

Jul 22, 2014

I have a column of numbers that are already formatted as text. Some of the data is duplicate which is fine. It's like a list of 6000 numbers. I want to conditionally format the column so that I can fill the cell with a color as long as it stays the same number, but if it changes to a new number make it a different color. I don't need a lot of colors. Two is fine. TI have Excel 2010.

View 4 Replies View Related

Excel 2010 :: Disable Something Like Text Box Related To Cells?

Aug 4, 2014

I am using excel 2010. When I click on cells on one column, something like text box will pop up with information related to that column. How can I get rid of this text box. How to disable this text box which I think it has a link between the text box and cells on that column.

View 1 Replies View Related

Excel 2010 :: Text To Column Runs Automatically?

Dec 15, 2012

I'm using Excel 2010 and have run into the following problem. I have data in a text editor that I need to separate. I copy and paste this data into Cell A1, then do a "Text to Col" function that separates the data correctly. Now I have other data to paste into other cells on the same sheet. Here's the problem....The "Text to Col" function runs automatically when I paste other data into any other cell on the WS. How do I turn this off without closing the WS?

View 4 Replies View Related

Excel 2010 :: Formatting As Phone Number From Text?

Jan 13, 2014

I am trying to format a cell (in Excel 2010) as a phone number. The problemis that the data comes over from our download as text. Is there an easier way then using the 'SUBSTITUTE' function to change format to a true phone number (so that we can mail merge into WORD)? Since it is extracted out as a text, using the 'phone number' format (under special) will not work. Using the 'SUBSTITUTE' formula to remove the parenthesis', the dash and the space work but is cumbersome.

Below is an example of the text format that is being extracted: (706) 378-7585

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved