Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Power Query Loaded Table - Change Data type through VBA

I have tables loaded on my Excel from Power Query. Some columns do not retain the data type and format I have specified in power query. For Example: Percentage type changes to Decimal(87.82%>0.878236484) and date type changes to Number(1/1/2020>43831) I hope to write VBA code to change the column data type by specifying the table name and column field header.

 

Kindly help with this.

 

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello, @Jimmy801  Thank you for taking the time to reply to my question. Yes, i understand we would need to format the data type back on excel. I just wanted to automate that with VBA. I found the code to do that.

 

Thank you.

View solution in original post

2 REPLIES 2
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

Power Query is loading the raw data to Excel. For a date this means a number and percentage is 0,xx. So the only way is to reformat your data in Excel once again. Don't forget to change the settings to keep changes of your format. So you don't need to write a VBA as long your column settings does change frequently.


If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

Hello, @Jimmy801  Thank you for taking the time to reply to my question. Yes, i understand we would need to format the data type back on excel. I just wanted to automate that with VBA. I found the code to do that.

 

Thank you.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors