Solved Vba CodeCopy certain value of cell from column

Microsoft Office excel 2007
December 22, 2015 at 08:38:35
Specs: Win 7, intel
I am having difficulty to right vba a code which is below

there is a huge data set in column C:C of which i have to work with 165 values which comes after repetition of 27 cells. I want to write a table which has 11 column and 15 rows.
This values should fill 11 column first then move to other row But when i try to run following code it gives error on assigning value to R1. Can you please help me in this regard


Sub ww()
'Initializing Variables
Dim i As Integer
Dim rw As Integer ' For pasting in rw
Dim col As Integer 'for pasting in col
Dim a As Integer
Dim R1 As Long
Dim rw1 As Integer
Dim col1 As Integer

rw = 24
col = 3
a = 0
rw1 = 6
col1 = 11
For i = 1 To 165
Cells(rw, col).Select 'Copy matched item
R1 = ActiveCell.Value
Cells(rw1, col1 + a).Value = R1
rw = rw + 27
a = a + 1
If a = 11 Then 'condition to paste in row uptill 323
a = 1
rw = rw + 1 ' Change row
End If
Next i

End Sub

See More: Vba CodeCopy certain value of cell from column

Report •

December 28, 2015 at 08:51:28
✔ Best Answer
First, a posting tip:

Please click on the blue line at the end of this post and read the instructions on how to post VBA code in this forum so that it is easier for us to read. Then edit/repost your code so that it looks similar to the example found via that link. Thanks!

As far as your statement "when i try to run following code it gives error on assigning value to R1" I have 2 comments:

1 - It might help if you told us exactly what error the code is showing. There are so many errors that VBA can present that telling us "it gives error" doesn't give us much to work with.

2 - Since we have no idea what your data looks like, it's hard for us to test your code and possibly reproduce the error. We don't know if you are working with numbers, text, dates, etc. If you could supply some example data for us to work with, that might help.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •
Related Solutions

Ask Question