ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copying columns (https://www.excelbanter.com/excel-discussion-misc-queries/250002-copying-columns.html)

Oldjay

copying columns
 
I could send this to the Programing form
I want to change the following macro to copy the list to the A column with
formats (color or no color) to a new sheet called Results. I will run the
macro again and place the list in the next column.etc

Sub MyCount()

Dim lw As Integer
Dim MyConstant As Integer
Dim Counter As Integer
Dim rRange As Range
Dim rCell As Range

Set rRange = Range("A2:F31")
lw = Range("A" & Rows.Count).End(xlUp).Row
MyConstant = Application.CountA(Sheets("Master").Range("A2:I31" ))
Range("K22").Value = MyConstant

For Each rCell In rRange
If rCell.Interior.ColorIndex = 36 Then
Counter = 1 + Counter
End If
Next rCell
Range("K21").Value = Counter

End Sub

Jim Thomlinson

copying columns
 
So this is not changing your existing macro. It is adding to it by having it
copy the contents of column A to the first available blank column on your
results sheet?
--
HTH...

Jim Thomlinson


"oldjay" wrote:

I could send this to the Programing form
I want to change the following macro to copy the list to the A column with
formats (color or no color) to a new sheet called Results. I will run the
macro again and place the list in the next column.etc

Sub MyCount()

Dim lw As Integer
Dim MyConstant As Integer
Dim Counter As Integer
Dim rRange As Range
Dim rCell As Range

Set rRange = Range("A2:F31")
lw = Range("A" & Rows.Count).End(xlUp).Row
MyConstant = Application.CountA(Sheets("Master").Range("A2:I31" ))
Range("K22").Value = MyConstant

For Each rCell In rRange
If rCell.Interior.ColorIndex = 36 Then
Counter = 1 + Counter
End If
Next rCell
Range("K21").Value = Counter

End Sub


Oldjay

copying columns
 
I just want to modify the existing macro to copy all cells with text (color
or no color) to the first available column in Results

"Jim Thomlinson" wrote:

So this is not changing your existing macro. It is adding to it by having it
copy the contents of column A to the first available blank column on your
results sheet?
--
HTH...

Jim Thomlinson


"oldjay" wrote:

I could send this to the Programing form
I want to change the following macro to copy the list to the A column with
formats (color or no color) to a new sheet called Results. I will run the
macro again and place the list in the next column.etc

Sub MyCount()

Dim lw As Integer
Dim MyConstant As Integer
Dim Counter As Integer
Dim rRange As Range
Dim rCell As Range

Set rRange = Range("A2:F31")
lw = Range("A" & Rows.Count).End(xlUp).Row
MyConstant = Application.CountA(Sheets("Master").Range("A2:I31" ))
Range("K22").Value = MyConstant

For Each rCell In rRange
If rCell.Interior.ColorIndex = 36 Then
Counter = 1 + Counter
End If
Next rCell
Range("K21").Value = Counter

End Sub


Oldjay

copying columns
 
I just want to modify the existing macro to copy all cells with text (color
or no color) to the first available column in Results

"Jim Thomlinson" wrote:

So this is not changing your existing macro. It is adding to it by having it
copy the contents of column A to the first available blank column on your
results sheet?
--
HTH...

Jim Thomlinson


"oldjay" wrote:

I could send this to the Programing form
I want to change the following macro to copy the list to the A column with
formats (color or no color) to a new sheet called Results. I will run the
macro again and place the list in the next column.etc

Sub MyCount()

Dim lw As Integer
Dim MyConstant As Integer
Dim Counter As Integer
Dim rRange As Range
Dim rCell As Range

Set rRange = Range("A2:F31")
lw = Range("A" & Rows.Count).End(xlUp).Row
MyConstant = Application.CountA(Sheets("Master").Range("A2:I31" ))
Range("K22").Value = MyConstant

For Each rCell In rRange
If rCell.Interior.ColorIndex = 36 Then
Counter = 1 + Counter
End If
Next rCell
Range("K21").Value = Counter

End Sub



All times are GMT +1. The time now is 01:24 PM.

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