Excel VBA to Google Sheets Script

Madraykin

Board Regular
Joined
Jan 4, 2012
Messages
56
Hi All,

So I built this cool VBA coded heat map in Excel BUT...... having moved to a new role they do most of their work in Google Sheets so they can be collaborative.

Problem is I need to recreate my heat map but, obviously, Google Sheets does not rely on VBA (it's Javascript instead isn't it???)

I know this isn't strictly an Excel question, but does anyone know how I can transfer this function into Google Sheets and have the same effect? (I can do all the background work such as naming objects)

Code:
Sub Paint()  Dim i As Integer
  For i = 1 To 380
    Range("actOrder").Value = i
    ActiveSheet.Shapes(Range("actShape").Value).Fill.ForeColor.RGB = _
    Range(Range("actColour").Value).Interior.Color


  Next i
  
End Sub

If anyone needs any background I followed an online tutorial to do this - I know you guys aren't keen on external links here, but if you google 'dynamic geographic heat map' it's currently the top result, on a site called vertex42.com

Equally if anyone can think of an easier/better way to do this so that an Excel document can be stored online and updated regularly let me know!

Sorry if slightly off topic - I didn't know where else to go as other forums are always so demeaning of me and you guys are always so lovely and helpful!

Mads
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Mads

What type of shapes are you referring to in the code?
 
Upvote 0
Hi Norie,

I have a map of the UK with all the 400+ local authority districts as separate images, they have all been individually named in Excel (I'm assuming there is a similar possibility in Sheets)?

Thanks for the reply!
 
Upvote 0
Mads

I'm not sure you manipulate shapes/images in Google Sheets as you can in Excel.

You can 'insert' images and drawings but I can't seem to find a way to reference them in Google Script, well I haven't found anything so far - I'll have another look later.

PS Can you post a link to the tutorial for the heat map?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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