rows

C

Charles Chickering

I'll go with the general belief that "few" = 3. If this needs changed, change
the constant "FewRow"

Sub SelectMostOfRow()
Const FewRow As Long = 3
Range("A1").EntireRow.Resize(, _
Columns.Count - FewRow).Offset(, FewRow).Select
End Sub
 
C

Charles Chickering

I'm not entirely sure that I know what you're asking but if you want to use
the address of those cells in a formula, try something like this:
Sub MakeFormula()
Const FewRow As Long = 3
Dim r1 As Range
Set r1 = Range("A1").EntireRow.Resize(, _
Columns.Count - FewRow).Offset(, FewRow)
'If you want to set a column to the sum of the cells,
'increment with the row, try this:
Range("A1:A2").Formula = "=Sum(" & r1.Address(False, True) & ")"

End Sub
 
L

lifeguardernie

lets say i want to count all the times 'a' comes up
so i write out =countif (1:1,"a") and i get a message that i created a circle
how do i input the range to be all but the first 3 columns?
 
C

Charles Chickering

Pretty much the same.

Dim r1 As Range
Set r1 = Range("A1").EntireRow.Resize(, _
Columns.Count - FewRow).Offset(, FewRow)
'If you want to set a column to the sum of the cells,
'increment with the row, try this:
Range("A1:A2").Formula = "=CountIf(" & r1.Address(False, True) & ",""a"")"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top