TransWikia.com

Syntax error on getting multiple range VBA

Stack Overflow Asked by Michael Norman on December 20, 2021

Here is part of my code:

For n = 0 To maxCol Step 1

studentRange = ws.Range(Columns(n) & curRow Columns(n) & classRange)
totalStudents = Application.WorksheetFunction.Count(studentRange)
newSheet.Range("A" & activeRow).Offset(columnoffset:=activeCol).Value = totalStudents

Next n
Loop

What I am trying to do is to get all the number of students that take subject from each class (class on the column (n)). I have been getting syntax error on the third line of the code – beginning with studentRange, and also a type mismatch on the fourth line. What I am trying to get is the range from that particular school hence why I need two ranges – like A1:B40)

I am very new to VBA and have been trying to solve this but still no luck.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP