Question

I essentially have a bunch of macro buttons that fill down my formulas to a determined amount of rows by looking at another spreadsheet and seeing where the data stops:

Range("A4:A" & Sheets("Core Data2").Range("A" & Rows.Count).End(xlUp).Row).Formula = "=IF(EXACT('Core Data2'!E4,'Core Data '!E4),""True"",""Difference in Pre-Population Information"")"

Imagine about 20 of those, each a separate button that does the same thing with a different formula at the end for a different column. Core Data 2 is the data sheet that I am referencing. Core Data is the other spreadsheet I am comparing the data (for the example above)

I am very new to macros, and I was wondering how I could put all 20 of the statements similar to the one I have above into one macro. Instead of having 20 buttons that essentially do the same thing, just have one button that takes all of the macros and creates one big one, filling down all my formulas for every column, instead of doing all of them 1 by 1.

Any help would be great. Thanks.

Was it helpful?

Solution

Didn't realize it would be so simple. All I did was just add each formula right after the other without any AND statement and it seems to work just fine.

I essentially just wrote something like this in the button code:

Range("A4:A" & Sheets("Core Data2").Range("A" & Rows.Count).End(xlUp).Row).Formula = "=IF(EXACT('Core Data2'!E4,'Core Data '!E4),""True"",""Difference in Pre-Population Information"")"

Range("A4:A" & Sheets("Core Data2").Range("A" & Rows.Count).End(xlUp).Row).Formula = "=IF(EXACT('Core Data2'!E4,'Core Data '!E4),""True"",""Difference in Pre-Population Information"")"

Imagine they were different formulas at the end obviously, but this seemed to work just fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top