Solved

Preserving formatting after data refresh in a table in Excel

Posted on 2016-10-04
3
52 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
Comment Utility
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
Comment Utility
@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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

12 Experts available now in Live!

Get 1:1 Help Now