473,729 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

On Format Event in Excel?

12,516 Recognized Expert Moderator MVP
Is there an event that triggers when formatting on a cell changes?

What I need to do is copy the formatting changes in one worksheet to another worksheet whenever the user changes the formatting. I looked but couldn't find any such event. The Change event doesn't trigger if you just change the formatting.
Mar 13 '07 #1
23 4504
8,834 Recognized Expert Expert
Is there an event that triggers when formatting on a cell changes?

What I need to do is copy the formatting changes in one worksheet to another worksheet whenever the user changes the formatting. I looked but couldn't find any such event. The Change event doesn't trigger if you just change the formatting.
To be honest with you, Rabbit, I don't think that such an Event exists that will dynamically react to formatting changes in individual Cells. I don't know the extent of your Worksheet but how about using the Workbook BeforeClose() Event. You can loop through Cells in a specified Range, check for specific Formatting patterns (Bold, Font, Font Size, Alignment, etc.) then transfer these to a specific Range within the 2nd Worksheet. This would, of course, still be a hugh undertaking.
Mar 13 '07 #2
12,516 Recognized Expert Moderator MVP
I figured I would have to do something like this. I was just hoping for a more efficient solution as the spreadsheet I'm working on is a favor for someone from a different unit and it's getting pretty unwieldy.
Mar 13 '07 #3
32,569 Recognized Expert Moderator MVP
I've checked through the events for both the WorkBook & the WorkSheet and there is nothing to match what you need I'm afraid.
You can stop the operator from changing the format by locking the WorkSheet, but otherwise...
Mar 14 '07 #4
12,516 Recognized Expert Moderator MVP
Yes, I looked through the events as well. I was hoping the On Selection Change event had a .PreviousSelect ion or something but I couldn't find anything to that that extent.
Mar 14 '07 #5
8,834 Recognized Expert Expert
Is there an event that triggers when formatting on a cell changes?

What I need to do is copy the formatting changes in one worksheet to another worksheet whenever the user changes the formatting. I looked but couldn't find any such event. The Change event doesn't trigger if you just change the formatting.
Just thought that you may be interested.
Expand|Select|Wrap|Line Numbers
  1. The following code will copy all Data and Formatting for the Cells 
  2. contained within the Range("A1:D4") to the Range("A10:D13") on 
  3. Sheet2. The only catch is that any data contained within the 
  4. specified Range on Sheet2 will be overwritten, but it is one step 
  5. closer to a 'Solution'.
  6. Worksheets("Sheet1").Range("A1:D4").Copy destination:=Worksheets("Sheet2").Range("A10:D13")
Mar 14 '07 #6
32,569 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. Call YourRange.PasteSpecial(Paste:=xlFormats)
will paste in just the formats if you need to know about that. I'm pretty sure there's nothing to trigger when the format changes though. Sorry.

BTW. Don't forget to Copy the other Range first and afterwards, use the :
Expand|Select|Wrap|Line Numbers
  1. Application.CutCopyMode = False
to lose the Copy selection highlighter for the copied range.
Mar 14 '07 #7
12,516 Recognized Expert Moderator MVP
Thanks for that but the problem was never being able to copy the formats but that there was nothing to trigger a format change event. I ended up just doing it through a macro.
Mar 14 '07 #8
32,569 Recognized Expert Moderator MVP
Last idea : Would the OnClose or OnSave events help at all?
Mar 14 '07 #9
12,516 Recognized Expert Moderator MVP
That's what I ended up doing, using a macro for when they want to see the changes right away and also in the On Close event in case they end up not using the macro.
Mar 14 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Sam Johnson | last post by:
HI I tried to send the following SQL string to an open databse, to export a table into excel format: g.Connection = conn 'valid OleDBConnection and Command objects g.CommandText = "SELECT * INTO XLSTest IN 'C:\' 'Excel 8.0;' FROM Table1" g.ExecuteNonQuery()
by: John Brock | last post by:
I am creating an Excel workbook using VB.NET, and have run into a problem. Excel at times insists on reformatting data that I enter into cells, e.g., converting "01234" to "1234", and this screws me up when I need to read the data back. When I run into this problem using Excel interactively I simply change the cell Number format from "General" to "Text", but I haven't been able to figure out how to do this using VB.NET. Here is a code...
by: desi.american | last post by:
I have a dynamically generates ASPX page with tables and data. Depending on user selection, the same page can be viewed as a simple web page (rendered in HTML) or as an excel spreadsheet. If the user chooses to view the page as an excel sheet, I attach the following line of code in C# in the Page_Load method. Response.ContentType = "application/vnd.ms-excel"; All this works fine. But some of cells read nvarchar fields from a database...
by: Agnes | last post by:
dim strPeriod as string = dtTransdate.ToString("dd-MMM-yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo) '--excel code ..Range("H2").Value = strPeriod When I read the excel, the column show "Apr-06" , seems correct , however ( it is a date format column), I try to change into string format in excel but still fail.
by: natrajsr | last post by:
Hi, I want to load the data of a excel sheet or in the exact excel sheet format into a Rich TextBox control. I have already worked with loading WORD into a Rich TextBox. It is working fine.; But it is taking long time for our need. So we thoguht, we can find another better solution rather than that. Can anyone help me to find out how to load a excel sheet or in the
by: ggupta78 | last post by:
Hi, Currently in our application we use the MHTML way of exporting to Excel i.e we render the datagrid HTML and set the MIME type to Excel. This works great but has the following limitation: 1. File size is extremely large in some cases 2. Our clients using older versions of Excel or OpenOffice 2.0 cannot open these files. So, we would want to export to excel using the BIFF format. But from
by: toffee | last post by:
Hi all, I created a little button which when clicked will run a query on mysql db and output the results as an excel spreadsheet. I do this by setting the header as application excel. All works well except for a very strange problem. Let's say a column should say 16500.22. When I run it here from the uk, the cell will show 16500.22 When someone in Netherlands runs it, the cells shows 16,500,220,000 It looks like Excel is mixing the...
by: Dirk Hagemann | last post by:
Hello, From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st 1901. For Example: the number 3566839 is 27.11.07 7:00. To calculate this in Excel I use this: ="01.01.1901"+(A1/24-(REST(A1;24)/24))+ZEIT(REST(A1;24);0;0) (put 3566839 in field A1 and switch the format of the result-field to the corresponding...
by: Dhananjay | last post by:
Hi all , I have got problem when i am tring to exportGridview Data into Excel format. It is going into text format ,but what i want is if the field is number/currency then it should go into number/currency format itself .Data exported to excel are all exported as text. Export to excel should maintain the formatting like numbers and money should be numbers and money in excel .
by: Joe Humburg | last post by:
Hi everyone, Looking for some help or ideas, on the folloiwng problem. Have an Access 2003 application that creates an Excel file containing data from an Access parameter query. This is accomplished with the following line: DoCmd.TransferSpreadsheet acExport, , "MyQuery", "ExcelFileName", True
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.