C
cfatz1
Hi-
I have the following code that I run for 8 consecutive
columns....columns I through P. As of now I am repeating this code 8
times (8 seperate blocks of code). This is obviously slowing the
process down quite a bit. My question is this: Is there a way to
combine all 8 columns into one block of code? Here is the code I am
using:
Range("I8").Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -7).Range("A1").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(0, 7).Range("A1").Select
If ActiveCell.Value <> "" Then
l = ActiveCell.Value + l
ActiveCell.Offset(1, -7).Select
Else
rng.Activate
ActiveCell.Value = l
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -7).Select
l = 0
End If
Loop
rng.Activate
ActiveCell.Value = l
l = 0
Then I have this code for column J....
Range("J8").Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -8).Range("A1").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(0, 8).Range("A1").Select
If ActiveCell.Value <> "" Then
l = ActiveCell.Value + l
ActiveCell.Offset(1, -8).Select
Else
rng.Activate
ActiveCell.Value = l
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -8).Select
l = 0
End If
Loop
rng.Activate
ActiveCell.Value = l
l = 0
TIA,
Chris
I have the following code that I run for 8 consecutive
columns....columns I through P. As of now I am repeating this code 8
times (8 seperate blocks of code). This is obviously slowing the
process down quite a bit. My question is this: Is there a way to
combine all 8 columns into one block of code? Here is the code I am
using:
Range("I8").Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -7).Range("A1").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(0, 7).Range("A1").Select
If ActiveCell.Value <> "" Then
l = ActiveCell.Value + l
ActiveCell.Offset(1, -7).Select
Else
rng.Activate
ActiveCell.Value = l
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -7).Select
l = 0
End If
Loop
rng.Activate
ActiveCell.Value = l
l = 0
Then I have this code for column J....
Range("J8").Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -8).Range("A1").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(0, 8).Range("A1").Select
If ActiveCell.Value <> "" Then
l = ActiveCell.Value + l
ActiveCell.Offset(1, -8).Select
Else
rng.Activate
ActiveCell.Value = l
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Set rng = Range(ActiveCell.Address)
ActiveCell.Offset(1, -8).Select
l = 0
End If
Loop
rng.Activate
ActiveCell.Value = l
l = 0
TIA,
Chris