Excel VBA - Loop through range and set formula in each cell

后端 未结 2 428
萌比男神i
萌比男神i 2021-01-21 08:58

I\'ve got a workbook where I have one worksheet which contains a lot of data. My goal is to create a macro that inserts a formula in a separate sheet to copy the data from the

相关标签:
2条回答
  • 2021-01-21 09:36

    Here is a former post of mine containing functions for conversion of column numbers to letters and vice versa:

    VBA Finding the next column based on an input value

    EDIT: to your 1004 error: Try something like this:

      =IF(Numbers1!E" & row & "<>0,Numbers1!A" & row & ","""")"
    

    (use ; instead of ,, and "" for one quotation mark in a basic string, """" for two quotation marks).

    0 讨论(0)
  • 2021-01-21 09:37

    Would not it be easier to get the cell address with the Cells.Address function?

    For example:

    MsgBox Cells(1, 5).Address

    Shows "$E$1"

    Best Regards

    0 讨论(0)
提交回复
热议问题