MS Excel / VBA help thread

Posted on
Page
of 91
  • The developer menu isn't in my ribbon, but I can get into the VBA window through the view>macros>edit options. Using Excel for Microsoft 365.

  • Or just use Alt + F11.

  • Excel for 365.
    Is that the desktop or browser version?

  • That will be desktop. Browser version doesn't have macros, it's got that new scripting language under Automate.

  • The developer menu isn't in my ribbon

    Show the Developer tab

  • Show the Developer tab

    Yes, I know how to do it. I was just saying that, if you've already got VBA in your file, you don't need the developer tab to view the code. If I were starting a new project from scratch then, yes, I might add it to the ribbon.

    And it's desktop.

  • This sounds like something I see at work if I download an xlsm file. To get round it, I right click on the file and go to 'properties'. In the 'attributes' section on the general tab, there's a 'security' section and a tick box on the right that's labelled something like 'unblock'. I tick the box and click 'ok'. Then I can run the macros.

    To view the macros in the file after this, open the file, go to 'view' and 'macros'.

    This plus quickly hitting alt+f11 seems to have worked.

    • right click
    • properties
    • general tab
    • security: Unblock
    • apply
  • You may have to post your code here.

  • Ha!

    Or were you referring to my edited comment about why module 1 and 2 are identical because I didn't double click and actually open them?

  • Ah, I see.
    Yeah, I think your original comment said something like "why this no work?". And I've yet to develop telepathic excel skills. It's not planned for roll out to our organisation until 2025.

  • For reasons I need to export only certain columns from a sheet and save that down as a .CSV file. This needs to be done via a macro button. Yes indeed.

    Is this possible?

  • Obvious would be to open a new workbook, copy the relevant columns into it and then save as CSV. Should be straightforward but there's always that extra bit of effort trying to fix it for some annoying edge case that you hadn't anticipated.

  • And if there are dates in it, just quit and go home.

  • Power query. don't open a csv in excel.

  • There are dates. In fact it's all about the dates.

    Can power query increment all the dates in a csv by a given amount?

  • Yeah, import, add new column looking at original column and apply thing to it.

  • Another one. In A1 I have 12345, I want cell B1 to have the formula =12355+C1
    C1 can be whatever number.

    In other words how do I get the value in A1 into the formula, not just a reference to cell A1.

    I've tried various combinations of text, value, &, encasing it in "" etc

  • ="="&valuetotext(A1)&C1 kind of works well enough for my needs

  • I say my needs, none of this was my idea

  • What are you trying to achieve here?

  • Replace dates in a cell with their numeric value+a value from another cell.

  • You don;t need valuetotext() here - this will convert it to a string already

    =""&A1&"+C1 "

  • Rather, replace dates in a cell with a formula like =42736+C1

  • Yes, I've probably overengineered it now. But I'm getting the right result so all good

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

MS Excel / VBA help thread

Posted by Avatar for mattty @mattty

Actions