Preserve Formatting When Pasting Part Of A Cell

Jun 4, 2013

Is it possible to preserve original text formatting when copying and pasting only part of a cell. Like, for example, a cell may contain ten words one of which is in red and underlined. How do you copy that one word and paste it in another cell so that it remains in red and underlined?

View 4 Replies


Preserve Formatting When Pasting Into A Cell

Feb 24, 2010

I am making template and trying to preserve formatting when users paste into a cell. From my research, I have found that this is impossible with simple format protection, it works to prevent changing formating, but if something is pasted (with normal paste), the format will change.

I have found a few solutions, but can't get them to work correctly

Solution A: Disable normal paste and substitute Paste Special - Values

How will this work with pasting via CTRL + V and the right click menu? I need both to function.

Solution B: Allow users to paste normally, but use a macro to copy formatting from a hidden sheet

I actually found code for this, but I couldn't figure out exactly how to impliment it. The sheet that users will be pasting into is called "Batch Summary" and I was trying to pull formatting from a sheet names "Batch Summary Format", but was getting an error.

View 9 Replies View Related

ADO ADODB.Connection: Preserve Cell Formatting

Oct 4, 2006

With ADO (ADODB.Connection), is there a way to preserve the cell formatting on the worksheet that the recordset data is copied to? Right now, if I format a Cell's font and font-size, then run the Macro to refresh the data, the formatting is gone and it's back to default formatting.

View 2 Replies View Related

Copying Part Of A Cell And Pasting It To The Cell Next To It

Sep 7, 2007

I have just generated a report of current customer numbers for our company. Unfortunately it reports it as "162 (162)". No idea why the program does it like that because it now makes using VLOOKUP very difficult.

What I want to do is copy the "162" part of the cell and paste it into the adjacent cell to make it easier to manipulate the worksheet. All of the customer numbers are in column D if that makes a difference.

View 9 Replies View Related

Preserve Formatting In PivotTable

Sep 18, 2007

I have made a pivot table and in Pivot table option Merge labels for colum b. I the problem i am facing is once i give this the next colum text filed is automatically arranged in center. I want the next colum as left alignment. Once i delete some rows in the data then if i refresh it automatically align the next colum to center. I have given the preserve formatting as well as i have un selected the autoformat colum.

View 2 Replies View Related

Preserve Formatting After XML Import

Jun 11, 2008

I have programmed a button that allows the user to import XML data into my workbook via the following

Sub Button5_Click()
FileToOpen = Application. GetOpenFilename("XML files (*.xml), *.xml")
If FileToOpen <> False Then
ActiveWorkbook.XmlMaps("RouteDoc_Map").Import (FileToOpen)
End If
End Sub

All my XML data comes in great to the associated mapped cells (on several worksheets) but the data that is coming in as a list erases the alternating white/gray conditional formating that I've applied via FORMULA IS =MOD(ROW(),2). How would I be able to preserve the alternating white/gray conditional formating, no matter how many rows are being imported via my button ?

View 6 Replies View Related

Preserve Formatting On Pivot Chart Refresh

Sep 22, 2009

have come across the apparent inflexibility of a pivot chart retaining its user defined formatting whenever it is refreshed.

I understand I can save my chosen formatting as a 'user defined' custom chart, which can be applied post-refresh, but was wondering if a simple bit of code would do this automatically, saving the additional clicks!

how to deal with the attached. How could I adapt the code to call in other 'user defined' charts I may create in the future?

View 8 Replies View Related

Preserve Cells Word Formatting Concatenating Text

Jun 7, 2008

I have a cell with some text in it that has formatting applied (bold in this case). I want to append some text on the end using VBA, but preserve the existing font formatting information. So say I have "one bold one" in my cell, I'm executing the following: ActiveCell.Value = ActiveCell.Value & "two"

But this wipes out the bold information. Is there any way of preserving the bold that's already in the cell. Either perhaps by copying the Characters object and reapplying it, or by some other method?

View 4 Replies View Related

Preserving Pivot Table Formats. Preserve Formatting Checked But...

Aug 28, 2009

I'm having a devil of a time trying to preserve the formatting on a pivot table that I made in Excel 2003. As near as I can tell, I've done the appropriate things --- check the preserve formatting box, uncheck autoformat --- but my formatting is not preserved when I pivot.

Adding to the mystery is the fact that some formatting is preserved but not all. I'm guessing either I'm missing something obvious or this is just an unruly, rogue pivot table that refuses to be formatted.

View 2 Replies View Related

Pasting Data From One Sheet To Another With Formatting And Cell References

Feb 11, 2010

I have inherited a monstrous speadsheet on which all data appears on a single sheet rather than being broken up across several sheets in some logical fashion.

One portion of this monster is a set of quite a few form letters, each of which reference various cells elsewhere in the spreadsheet.

I want to move all of these letters, together, to another tabbed sheet as a first step in reorganizing the monster.

Simply copying and pasting the cells or columns doesn't work. It fails in different ways depending on which pasting options I employ.

A very simplified version of my problem appears on the 5 sheets of the attached file, with what I hope is just enough further detail about the difficulty.

By the way, I also tried using the "Insert Copied Cells" option when pasting but since this failed with the exact same results as one of the other options I didn't include the results in the example shreadsheet.

View 5 Replies View Related

Pasting Cell Values Matching Destination Formatting?

Mar 31, 2014

I have browsed for two days looking for material on effecting this. The technique quoted most is watch for undolist for paste & auto fill then undo the change and paste the value again with specific formatting needs. This technique can be implemented in a worksheet_change event handler. The problem that I am facing is that the user can copy and past while my VBA is running. Once it is caught inside my own application class object event handler all that undo stack is already cleared. Therefore I have nothing that tells me if the user has entered the value via a paste action. By the time the value is pasted, all that formatting would have been entered. For example, a value that is interpreted by another workbook as DATE will have my destination formatting changed to DATE as well even though it is designed to be TEXT at design time.

So far I have not been able to think of a scheme to deal with this.

My basic intention is to always ensure the destination cell formatting remains as TEXT. If something is already interpreted as DATE after the paste even if I can convert to TEXT the string will appear totally differently. I have to find a way to paste the whole thing as TEXT in order to keep the string the same. The problem is that there is no intrinsic PASTE event in VBA. Without a method to undo that paste I cannot catch this at all.

View 1 Replies View Related

Formatting Part Of A Cell (colour)

May 13, 2012

I have a range where there text is listed like this

= Blue
+ Green
= Orange

This is the text to search for - and the colours I would like the text to be.

Is it possible to search (D5...D17) for these and set just those characters to the required colours. So that....

10 If Point 0|123 4.5000 then GOTO 50

would become

10 If Point 0|123 4.5000 then GOTO 50

View 1 Replies View Related

Copying And Pasting Conditional Formatting With Changing Cell Values

Mar 19, 2013

How to copy and paste conditional formatting with our changing the cell values. My first row of data starts in row 4 and here is what I have in D4

If D4 is less than or equal to AA4, AW4, BS4, CO4 then it will highlight D4

Now I want to copy that format and paste it for all rows in column D. The problem I'm having though is when I paste the formula it doesn't change to match the row I'm on. For example, when I paste it in D5 this is what I get

If D5 is less than or equal to AA4, AW4, BS4, CO4 then it will highlight D5

How do I paste it so that it will update to show AA5, AW5, BS5, and CO5. I want to be able to do this for 500 rows.

View 6 Replies View Related

Conditional Formatting Based On Part Content Of A Cell

Sep 10, 2009

I am using excel 2000. I want to apply conditional formatting to a range of cells if they contain (V) as part of the cell contents. The cells will generally look like this : 09.00-6 (V) or 9-5.30 (V). I want to shade any cell if part of the contents of that cell is (V).

View 2 Replies View Related

BeforeDoubleClick But Preserve Original Cell

Sep 18, 2008

Within Worksheet_BeforeDoubleClick, I have the following simple code extract that sets the appropriate autofilter to the correct value (and highlights a couple of cells for clarity) when a particular cell is double-clicked...

If Not Intersect(Target, Range("C10:AQ11")) Is Nothing Then

If Not Intersect(Target, Range("C10:D11")) Is Nothing Then

Selection.AutoFilter Field:=10, Criteria1:="C"
Range("C10:D11").Interior.ColorIndex = 36

End If

You'll be happy to hear that the event works as expected.

However I would like to add the following enhancement: after Worksheet_BeforeDoubleClick completes the "double-clicked cell" is selected, is it possible for the "original" cell to be re-selected once the event completes?

View 9 Replies View Related

Copy And Pasting Without The Formatting.

Nov 18, 2008

I regularly copy into notepad then copy that into excel because I don't want to carry over the text formatting. Is there a better way to do this? To set up the cells so that they don't try to carry the formatting over?

View 4 Replies View Related

Search & Replace - Preserve Cell Format

Jul 13, 2006

I'm using the code below to do a simple search & replace. The code is working fine.
My problem is after the search & replace is done, certain cells that contain numbers look weird with decimal points & plus signs similar to Format Cells - Scientific. How do I prevent these cells from looking 'weird' in my code?

I've attached a workbook with 2 sheets called Before & After. You can see the 'weird' cells in After.

Sub Macro1()
Cells.Replace What:=": ", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub

View 5 Replies View Related

Preserve Cell Number Format In Message Box

May 28, 2007

I'm writting an Excell VB application which reads data from my spreadsheet and places it into the text member of an IXMLDOMElement node in order to generate a QBXML request.

The cell I am reading from has datatype number with two decimal places as required by the xml scheme. The problem is that the Range.Value Variant data type drops the decimal point and any trailing zeros so that 1197.00 become 1197. Unfortunately, the QBXML parser requires to see the decimal as well as trailing zeros. So, 1197.90 must show up as precisely that. Changing 1197.90 into 1197.9, for example, also breaks the xml.

My Excel VBA book specifically states that a Variant data type holding numerical data will maintain the data type assigned to it.

I also tried declaring a local decimal (Dim MyDecimal As Decimal) thinking to try copying the Range.Value value to it before assigning to the QBXML field in order to force the correct data format but my VBA macro compiler does not apparently recognize "Decimal" as a valid data type event though my book clearly indicates it is one of the valid VB data types.

I am using Excel 2000. Are these problems solved in newer versions?

View 9 Replies View Related

Pasting Text Without Retaining The Formatting

Nov 20, 2009

I am in a situation where I have to copy-n-paste text from a webpage into Excel. When I do this, the pasted text keeps the formatting of the webpage. The font is the webpage font. The background color is the background color of the webpage. Etc.

I know that I can paste just the text itself, without any of the formatting, by right-clicking, selecting "Paste Special...", and then selecting "Text" instead of "HTML". I am wondering if there is an option somewhere that will do this automatically when I hit CTRL-V instead of requiring me to pull up the Paste Special dialog box.

View 9 Replies View Related

How To Copy Page Formatting When Pasting Into New Workbook

Dec 28, 2011

I've been trying to code a macro that will select a worksheet (that has formulas) to copy just the values into a new workbook. I want the page setup data to also be included. It seems that if a select the workbook and do a copy, it includes the formulas. If I select the cells, then do a paste/special values into the new workbook, the page setup is the default one. Each worksheet that I want to copy/paste has different page setup values and I'd like to be able to carry over the page setup. Otherwise, I have to have code to do all the page setup in the macro. There are over 20 worksheets and it's slow.

This code does the copy/paste special but no worksheet page setup is included

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWorkbook.SaveAs Filename:= _
"U:My DocumentsLearning VBA filesTestNewWorkbook.xls"
Windows("ProjectFilesChapter07 test.xls").Activate

View 3 Replies View Related

Conditional Formatting Of A Part Of Column

Dec 21, 2013

I'm trying to build a simple spreadsheet that allows me to auto highlight the day in the week and part of the column.

I include a sample sheet... above saturday there is the formula I use to determine the day of the week.

View 14 Replies View Related

Multiple Lookup: List Of Part Numbers Based On The Product Part Code

Feb 12, 2009

I'm creating a worksheet that gives a list of part numbers based on the product part code. In most cases I can use the following.

=LOOKUP(O6,{0,1,2,3,4},{"NONE (M25)","SMP-55-001","SMP-55-004","SMP-55-008","SMP-55-014"})

so this gives a part number depending on what number is placed in O6. What I need to do know is look at 2 different cells and for each combination of numbers give a different part number. so if A1 is 2 and B1 is 3 give a certain result.

View 3 Replies View Related

Array Won't Preserve Values?

Apr 8, 2014

I am trying to store values into a dynamic array. The size of the array will vary each time, so I need the range to be dynamic. Most importantly, I need all values to be retained in the array. Currently, a value will be stored, but once the next round of the for loop is initiated, the array changes to "<subscript out of range>" and stays that way until the it is replaced by the next value. So, there isn't an accumualtion in the array--it goes one value, to out of range, to one value, etc.

View 8 Replies View Related

VBA - Preserve Hyperlink When Using VLOOKUP?

May 26, 2014

I am having when trying to preserve a hyperlink when using VLOOKUP. I have two worksheets within the same workbook. Worksheet 1 contains a lot of information for internal use(many of the cells in all of the columns contain hyperlinks to web addresses), and Worksheet 2 should be a version identical to this, showing only the selected columns suitable for external use. This is to avoid using two different 'work trackers'; so, when info in Worksheet 1 is updated, Worksheet 2 should automatically be updated and reflect this.

I am currently using the following code:

Function GetHyperLink(r As Range) As String
If r.Hyperlinks.Count Then
GetHyperLink = r.Hyperlinks(1).Address
End If


View 8 Replies View Related

Convert To Pdf Preserve Link

Aug 27, 2009

I m trying to save my excel file as a pdf. all is working great except the fact that i have a few cells that contain hyperlinks (via HYPERLINK formula). when exported, they are being converted to a simple text, loosing the link.

thus my question is this, would anyone know of a proper way to export an excel file so that ALL hyperlinks are preserved? be it with excel or any other program/converter.

View 9 Replies View Related

Preserve Function When Inserting Cells

Apr 21, 2009

I'm using IF functions to get the difference of two cells. An example:

View 5 Replies View Related

Delete Rows But Preserve Formula?

Apr 29, 2012

I have an inventory sheet with rows containing a formula. I've placed the same formula in all 65536 rows that Excel 2003 has.

I have a macro to delete unused items. It searches for an item number then deletes that row. (Actually it deletes the item number and a partial row based on an offset, but that was for an earlier version and an entire row would be okay) When a row is deleted, all the other rows move up and Excel creates a new last row (65536) The problem is that this new row has no formulas. While it's probably unlikely that I'll ever blow through 65536 rows, it seems sloppy to leave this unaccounted for.

Is there a way to either add the existing formula(s) to the last row...or insert a new row *somewhere* that is empty except for the formula of the other rows in the sheet? Here's what I have for the existing code.

'Search for item to delete based on entry to InputBox
Sub Delete_Item()
Dim FindString As String
Dim Rng As Range
Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String


View 9 Replies View Related

VB Code To Reinstate/preserve Formula

Apr 25, 2009

My current headache is that I want to be able to reinstate excel formula when the delete key is hit. However there this is a slight catch. I don't just want to be able to do this for one cell but reinstate the same excel forumla in an entire cloumn (ie for multiple rows). On top of this I also need to find a way of being able to do this for multiple columns (ie column 1 has formula 1, column 2 has formula 2 etc.....)

I have found this but I am having trouble adapting it to suit my purpose. This code just reinstates the formula for 1 cell.

Worksheet module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address "$A$1" Then
Application.OnKey "{del}"
Application.OnKey "{del}", "myFormula"
End If
End Sub

Sub myFormula()
Worksheets("Sheet1").Range("A1").Formula = "=RC[1]+RC[2]"
End Sub

View 9 Replies View Related

Preserve Formula References After Sort

Oct 23, 2006

I have noticed that if I create a row and put a reference formula in one of the cells (i.e. in Cell B3 I have "=B4", to show contents of B4), then after I do Sort and Row 3 moves else where, formula in what used to be B3 no longer points to B4, but rather to B<new row + 1>.

Absolute reference doesn't seem to be an option (i.e. "=$B$4") since after sorting rows in question the cell references in my B cells do get screwed up. I guess I want to bind a certain cell to a certain other cell, and keep that bind no matter where I move the row.

View 9 Replies View Related

Modify Array Forumula And Preserve Brackets

Dec 11, 2008

How would I modify a (very long) array formula, while preserving the brackets? Or re-creating them? I've tried doing it "at the cell" without luck.

View 2 Replies View Related

Copyrights 2005-15, All rights reserved