Forgive my ignorance and my lack of vernacular. I'm very new to writing macros and coding. Everything I know today is self-taught and derived from forums, google, books, and whatever else I have been able to consult.
I have a macro that loops to create a specific formatting for "events". It loops based on the content located on a different sheet ('Data Dump'). The following is a general idea of how the formatting is laid out:
[TABLE="class: grid, width: 250, align: left"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Event Number:[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD]2018-02001[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Event Number:[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD]2018-02002[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
"2018-02001" is what I've got a question about, which is explained later.
Forgive me if the visual is obnoxious or "noob-like". It is the best way I can assist in conveying my question. The number below the "Event Number" is achieved via formula early on in my macro and is calculated as follows:
This formula is then auto-filled to the end of the data and the "001" (at the end of the formula) increases by one. This works perfectly for the 'Data Dump' sheet, but not later on.
My macro is written to generate these "events" using a lot of "Offset" (properties?). This puts 16 cells between the "Event Numbers". I would like to achieve essentially the following:
for each event type. Meaning, I just want these event numbers to be equal to the content listed in the 'Data Dump" sheet. The current code I have is:
However, it doesn't account for the 16 cells in between each event. The code above yields "2018-02002" which is exactly what I want. Then, the following event comes back as "2018-02019". Tinkering with the above formula I discovered that if I keep a running total of the -50 portion of the code to subtract 16... then I get what I want, as follows:
yields "2018-02002"
yields "2018-02003"
yields "2018-02004"
yields "2018-02005"
And so on... Is there a way to tweak this formula or perhaps create a new one that can achieve my desired outcome?
I greatly appreciate the assistance.
I have a macro that loops to create a specific formatting for "events". It loops based on the content located on a different sheet ('Data Dump'). The following is a general idea of how the formatting is laid out:
[TABLE="class: grid, width: 250, align: left"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Event Number:[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD]2018-02001[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD](data)[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Event Number:[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD]2018-02002[/TD]
[TD](data)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
"2018-02001" is what I've got a question about, which is explained later.
Forgive me if the visual is obnoxious or "noob-like". It is the best way I can assist in conveying my question. The number below the "Event Number" is achieved via formula early on in my macro and is calculated as follows:
Code:
ActiveCell.FormulaR1C1 = "=YEAR(RC[-59])&""-""&(TEXT(MONTH(RC[-59]),""00"")&""001"")"
This formula is then auto-filled to the end of the data and the "001" (at the end of the formula) increases by one. This works perfectly for the 'Data Dump' sheet, but not later on.
My macro is written to generate these "events" using a lot of "Offset" (properties?). This puts 16 cells between the "Event Numbers". I would like to achieve essentially the following:
Code:
='Data Dump'!C3
Code:
ActiveCell.Formula = "=INDIRECT(""'Data Dump'!""&ADDRESS(1*ROW()-50,3))"
However, it doesn't account for the 16 cells in between each event. The code above yields "2018-02002" which is exactly what I want. Then, the following event comes back as "2018-02019". Tinkering with the above formula I discovered that if I keep a running total of the -50 portion of the code to subtract 16... then I get what I want, as follows:
Code:
ActiveCell.Formula = "=INDIRECT(""'Data Dump'!""&ADDRESS(1*ROW()[B]-50[/B],3))"
Code:
ActiveCell.Formula = "=INDIRECT(""'Data Dump'!""&ADDRESS(1*ROW()[B]-66[/B],3))"
Code:
ActiveCell.Formula = "=INDIRECT(""'Data Dump'!""&ADDRESS(1*ROW()[B]-82[/B],3))"
Code:
ActiveCell.Formula = "=INDIRECT(""'Data Dump'!""&ADDRESS(1*ROW()[B]-98[/B],3))"
And so on... Is there a way to tweak this formula or perhaps create a new one that can achieve my desired outcome?
I greatly appreciate the assistance.