ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   for a = d to cz (https://www.excelbanter.com/excel-discussion-misc-queries/163703-%3D-d-cz.html)

lawson

for a = d to cz
 
I guess my first question is, does this work?

for a = d to cz

or do i have to use numbers? the basic idea is to have a program that goes
from column to column along row 1 and look for the value 1. if it finds that
value then it will copy formulas vertically in that column within a certain
range as follows:

Private Sub CommandButton3_Click()

For a = d To z
If Range(a & "1") = 1 Then ''''''''IT CRASHES HERE!
Range(a & Range("by1")).AutoFill Destination:=Range(a & "9:" & a &
Range("by1")), Type:=xlFillValues
End If
Next a

End Sub

probably not the best method anyway...

Trevor Shuttleworth

for a = d to cz
 
Use Cells(row, column) with a numeric column variable.

For example:

for ColumnCounter = 3 to 104
If Cells(1,ColumnCounter) = 1
:

Regards

Trevor


"lawson" wrote in message
...
I guess my first question is, does this work?

for a = d to cz

or do i have to use numbers? the basic idea is to have a program that goes
from column to column along row 1 and look for the value 1. if it finds
that
value then it will copy formulas vertically in that column within a
certain
range as follows:

Private Sub CommandButton3_Click()

For a = d To z
If Range(a & "1") = 1 Then ''''''''IT CRASHES HERE!
Range(a & Range("by1")).AutoFill Destination:=Range(a & "9:" & a &
Range("by1")), Type:=xlFillValues
End If
Next a

End Sub

probably not the best method anyway...




lawson

for a = d to cz
 
how do you use cells for a range?

cells (3,2:3,5) ?

"Trevor Shuttleworth" wrote:

Use Cells(row, column) with a numeric column variable.

For example:

for ColumnCounter = 3 to 104
If Cells(1,ColumnCounter) = 1
:

Regards

Trevor


"lawson" wrote in message
...
I guess my first question is, does this work?

for a = d to cz

or do i have to use numbers? the basic idea is to have a program that goes
from column to column along row 1 and look for the value 1. if it finds
that
value then it will copy formulas vertically in that column within a
certain
range as follows:

Private Sub CommandButton3_Click()

For a = d To z
If Range(a & "1") = 1 Then ''''''''IT CRASHES HERE!
Range(a & Range("by1")).AutoFill Destination:=Range(a & "9:" & a &
Range("by1")), Type:=xlFillValues
End If
Next a

End Sub

probably not the best method anyway...





Trevor Shuttleworth

for a = d to cz
 
?range(cells(1,1),cells(3,3)).Address
$A$1:$C$3

?range(cells(3,2),cells(3,5)).Address
$B$3:$E$3



"lawson" wrote in message
...
how do you use cells for a range?

cells (3,2:3,5) ?

"Trevor Shuttleworth" wrote:

Use Cells(row, column) with a numeric column variable.

For example:

for ColumnCounter = 3 to 104
If Cells(1,ColumnCounter) = 1
:

Regards

Trevor


"lawson" wrote in message
...
I guess my first question is, does this work?

for a = d to cz

or do i have to use numbers? the basic idea is to have a program that
goes
from column to column along row 1 and look for the value 1. if it finds
that
value then it will copy formulas vertically in that column within a
certain
range as follows:

Private Sub CommandButton3_Click()

For a = d To z
If Range(a & "1") = 1 Then ''''''''IT CRASHES HERE!
Range(a & Range("by1")).AutoFill Destination:=Range(a & "9:" & a &
Range("by1")), Type:=xlFillValues
End If
Next a

End Sub

probably not the best method anyway...







Dave Peterson

for a = d to cz
 
You could use something like this, too.

dim iCol as long
with worksheets("somesheethere")
for icol = .range("d1").column to .range("cz1").column
...



lawson wrote:

I guess my first question is, does this work?

for a = d to cz

or do i have to use numbers? the basic idea is to have a program that goes
from column to column along row 1 and look for the value 1. if it finds that
value then it will copy formulas vertically in that column within a certain
range as follows:

Private Sub CommandButton3_Click()

For a = d To z
If Range(a & "1") = 1 Then ''''''''IT CRASHES HERE!
Range(a & Range("by1")).AutoFill Destination:=Range(a & "9:" & a &
Range("by1")), Type:=xlFillValues
End If
Next a

End Sub

probably not the best method anyway...


--

Dave Peterson


All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com