RowVar Formula error

Red over White

Board Regular
Joined
Jul 16, 2011
Messages
132
Office Version
  1. 365
Platform
  1. MacOS
I'm getting 'Run time error 424' on the following:

Option Explicit

Sub Input2() '

Dim r As Integer
Dim RowVar As Variant

RowVar.Formula " =SUM(Input!A1)"

Sheets("Input2").Rows(RowVar(r + 6).RowVar(r + 6)).Select
Selection.Interior.Colour = vbRed

End Sub

Also will "r + 6" work
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You haven't assigned a value to RowVar and you cannot assign a formula to a variable.
 
Upvote 0
Perhaps you mean

Code:
RowVar = Sheets("Input").Range("A1").Value

But you haven't assigned a value to r.
 
Upvote 0
My aim is to identify subsequent rows each month, 86, 87 and so on. I have a different macro which takes care of Input!A1. I know that as the number changes each month, I have to use a letter to signify it. Have I gone off on the wrong course?

Thanks
 
Upvote 0
Perhaps you mean something like this

Code:
Sub Input2() '
Dim RowVar As Variant
RowVar = Sheets("Input").Range("A1").Value
Sheets("Input2").Rows(RowVar & ":" & RowVar + 6).Interior.Color = vbRed
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,135
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top