Displaying query tables

BigMillBoy

New Member
Joined
Sep 6, 2021
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
I have a spreadsheet that is used to display a query table for a daily meeting. Each day this file is updated and recently the query table has been having some issues. The table used to be displayed in a particular location and now it is being pasted higher up in the sheet where it is in the way. Going back to old copies of this it works correctly and as far as I can tell the code is identical. I'm not the best with this language and the spreadsheets code was created before I started in this position.
I have pasted the code below. I would like for the table to be displayed at K46:AK80 however currently it is at A16:AK50
How do i fix this issue?

Sub HeatMap()
'
' HeatMap Macro Updates the Heat Map Table

'
Sheet5.QueryTables(1).Refresh 'Refreshes the data in the query table (data must be input manually)
Columns("K:AK").EntireColumn.AutoFit 'Ensure background refresh is off (right click option on the table)
'adjusts the table shape after repfresh
Columns("S:S").ColumnWidth = 6
Columns("K:K").ColumnWidth = 1
Columns("X:X").ColumnWidth = 5
Columns("AB:AB").ColumnWidth = 3
Columns("M:M").ColumnWidth = 6.5
Range("A1").Select
ActiveWindow.Zoom = 10
Range("K46:AK80").Select
ActiveWindow.Zoom = 110
'Range("L59").Select

End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I must be missing something.
The code is not creating the query just refreshing it and doing some formatting and assumes it is already at AK46.
All you should need to do is to select the whole of the current table Cut (ctrl+X) and paste it to AK46.

Did this not work ?
 
Upvote 0
I must be missing something.
The code is not creating the query just refreshing it and doing some formatting and assumes it is already at AK46.
All you should need to do is to select the whole of the current table Cut (ctrl+X) and paste it to AK46.

Did this not work ?
That is an obvious solution and what I have been doing... However, I want this to be done automatically each time as I am running a meeting and need to focus on other things.
 
Upvote 0
That implies that the output location of the query keeps moving.
What is making it do that ? That is not the normal behaviour of PQ.
The output table has a name and you could use that to tell the macro to cut & paste it back to the location you want it but something is going on to make that even necessary.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top