Jump to content

VBA Macro edit to copy formula down until end of data (SIMS Advanced reporting)


Recommended Posts

Posted

Hello all,

 

I recently attended the SIMS advanced reporting with excel analysis training course and have been having a play with some attendance reports. I managed to use the following code to copy a formula down the required amount of cells in my student data tab.

Sheets("Student Data").Select

Dim r As Integar

r = ActiveSheet.Range("A1").End(xlDown).Row

Range("p2")Select

Selection.AutoFill Destination:=Range("p2:p"&r)

 

I have tried a few different ways to get this to work for multiple (6) different columns but am still struggling to get it to happen. I have a Compile error message which stated 'Wrong number of arguments or invalid property assignment'.

 

Any suggestions gratefully received.

 

Olivia

Posted
Hello all,

 

I recently attended the SIMS advanced reporting with excel analysis training course and have been having a play with some attendance reports. I managed to use the following code to copy a formula down the required amount of cells in my student data tab.

Sheets("Student Data").Select

Dim r As Integar

r = ActiveSheet.Range("A1").End(xlDown).Row

Range("p2")Select

Selection.AutoFill Destination:=Range("p2:p"&r)

 

I have tried a few different ways to get this to work for multiple (6) different columns but am still struggling to get it to happen. I have a Compile error message which stated 'Wrong number of arguments or invalid property assignment'.

 

Any suggestions gratefully received.

 

Olivia

 

Sheets("student Data").Select

Dim r As Integer

r = ActiveSheet.Range("A1").End(xlDown).Row

Range("H2").Select

Selection.AutoFill Destination:=Range("H2:H" & r)

Range("J2").Select

Selection.AutoFill Destination:=Range("J2:J" & r)

Range("D2").Select

Selection.AutoFill Destination:=Range("D2:D" & r)

Range("E2").Select

Selection.AutoFill Destination:=Range("E2:E" & r)

Range("F2").Select

Selection.AutoFill Destination:=Range("F2:F" & r)

 

this is how i did my one for our school.

 

Regards

 

Mukesh

  • Thanks 1
Posted

Hi Olivia,

 

I'm no programmer - but would the fact you've spelt integer with an a not an e be a contributing factor as to why your original code didn't work?

 

Sam.

Posted

Hi Sam, that was just a typo in this message it was spelt correctly in excel code. I don't think it would have worked at all with a typo in code. Always something to be mindful of though.

 

Thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...