Excel VBA format - excel

i have a sheet where i connect to SQL. how can i create vba where every time i click refresh data connection query from power query, it will convert my text to number. Once it convert, i would like to format it to percentage and some are in accounting format. Upon refresh again, the same format will stick as it is without need to click format again. Is this possible?

Yes, it is possible, by using onChange event in VBA:
https://learn.microsoft.com/en-us/office/vba/api/excel.worksheet.change

Related

Power Query Date format issue

I use Powerquery to extract from database using sql, when i am in the editor it displays normal, but when i close and load, the format changes to a strange format
Example
in powerquery editor window display is 6/28/2021 5:21:38pm
in excel it changes to 44200.68331
so everytime i have to manualy change the format back.
anyone know what date format this is, and how i can have it automatically save the format from the editor screen to excel?enter image description here
thanks in advance

How to prevent excel from showing dates as number

I'm using excel to get data from an external SQL server table, using power query, in the query window it shows date/time fields normally, but in the excel sheet, it shows it as a number, even when I change the type and cast and make a refresh it transform it again as a number.

Formatting Excel Power Query Table

I created an Excel Power Query that pulls cryptocurrency data from coinmarketcap.com's API. I want to format this data, but it won't let me.
For instance, I want the price coloumn to have a $ sign in front of it, but when I hit the $ sign in Excel, it doesn't work.
How do I enable the formatting of this data?
format the cell as Accounting Number

EXcel use of BDP and BDH function

I want to retrive data from a past date about VOLUME_AVG_30D. Can I? I just could use the BDP to retrive this data and then this just give me the last update about this information.
Yes you can, that's what the excel adding does. Just go to the formula builder on the ribbon in the excel add-in. If you need history, use bdh.
Formula: =BDH(security, field(s), start date, end date)
Sample: =BDH($B$6,$C$7:$C$7,"12/23/2016","","Dir=V","Dts=S","Sort=A","Quote=C","QtTyp=Y","Days=T","Per=cd","DtFmt=D","UseDPDF=Y","CshAdjNormal=N","CshAdjAbnormal=N","CapChg=N","cols=2;rows=102")

How to set Excel date with text in a single cell with dateformats

I have an excel report which is generated from the web application.
In that report I need to place "(01/25/2013) Control", it's getting from a database query. I can't change the database query.
I want to change the date format as dd/mm/yyyy with including text like "(25/01/2013) Control", but my query gives date in mm/dd/yyyy format.
Please help me regarding above one.
One option would be to format the cell in the following way
Custom Number Format
"("dd/mm/yyyy") Control"

Resources