Search code examples
excelvbatablet

macro in excel tablet


ealier i created a vba macro using this code

Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
    Range("A56").Value =  Range("A56").value & " Text"
End Sub

it worked great until i opened it in excel mobile it said it can run vba macro is there anyway to make it work on a tablet? can i write it differently? all i want it a fast way to add some premade sentence to a existing field with a value

thanks for ur help :)


Solution

  • VBA only runs in Excel for desktop (Windows or Mac). That's not going to change.

    You can easily create a worksheet formula that does what your macro does. Instead of ticking a tick box, you can put a character like "y" or "n" into a cell, for example into cell A1. Then you can use a formula like this:

    =if(A1="y",A56 & " Text","")
    

    This formula based approach will work on any Excel platform, i.e. Windows, Mac, web, tablets, and mobiles.

    Edit after comment:

    If you want to check several cells, then you can nest IF functions or you can use IFS (available only in Office 365).

    =if(A1="y",A56 & " Text",if(A2="y",A56 & " some other text", if(A3 = "y",A56 & " some third option","other")))
    

    using IFS() in Offic 365

    =IFS(A1="y",A56 & " Text",A2="y",A56 & " some other text",A3 = "y",A56 & " some third option")