Solved

Preserving formatting after data refresh in a table in Excel

Posted on 2016-10-04
3
67 Views
Last Modified: 2016-10-26
I have an Excel document that pulls data from a database into an Excel table and e-mails this file to certain staff. I've set up formatting on this table so that it sorts by certain columns, has another column with currency formatting, and has data slicer filters ready to be used. However it seems that this all disappears every time there is a data refresh (which is every time task scheduler runs the command to refresh data). What are some ways that I can preserve some or all of these formatting?

I've seen suggestions that apply to pivot tables, but this isn't one, and doesn't look as good as a pivot table. I've also seen suggestions on having another worksheet reference the data, but I haven't found a good working solution yet. Another workbook and a query import probably wouldn't work since it's e-mailing the data.

(I am using Jet Reports, for those familiar with it)

Thanks.
0
Comment
Question by:ruhkus
3 Comments
 
LVL 1

Accepted Solution

by:
Vijay R earned 500 total points
ID: 41828505
Hi
I guess the program to export data from Database to the excel is not written in VBA and giving my solution. Please let me know if it is not.
insert a ActiveX control button in the excel menu Developer in say "Sheet1". Right click the button and click "View code" to start the coding. Write the below lines between the "Private Sub CommandButton21_Click()" and "End Sub". This is the procedure name for mine, it may be different for you.
Range("I1:I10").Select
Selection.NumberFormat = "$#,##0.00"
if you want to have absolute number (positive value) then formula is
Selection.NumberFormat = "$#,##0.00_);($#,##0.00)"
For sorting write as follows in the same procedure (Or sub)
 ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("G1:G5"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet1").Sort
        .SetRange Range("G1:G5")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
0
 
LVL 8

Expert Comment

by:LajuanTaylor
ID: 41828506
@ruhkus - Have you checked the Jets Reports Support site? I'm not sure of your version or how much of their tool suite you have available, but I think there are several options. For example:
Using Report mode versus Design mode -
https://jetsupport.jetreports.com/hc/en-us/articles/219402737-Difference-between-Design-Mode-and-Report-Mode-

If you have Dynamics NAV, you might be able to resolve the formatting issue:
https://jetsupport.jetreports.com/hc/en-us/articles/219403337-Uploading-Budget-Data-to-Dynamics-NAV

Lastly,

Take a look at leveraging a report template:
https://jetsupport.jetreports.com/hc/en-us/articles/219402677-Additional-Resources-for-Jet-Essentials
0
 

Author Comment

by:ruhkus
ID: 41834339
Thanks for the feedback. I was able to get what I need by using a macro, but I was really hoping not to go that route, since as IT Manager, I'm always encouraging staff to not press that button to enable macros!

Lajuan, I looked at those links but I wasn't able to find anything I could use. Perhaps I'm too new to JET Reports, but did you see something in particular that would address my need?
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now