Hi All,
I'm pulling my hair out (partly cause my VBA skills are nill, and because I know this can be easily done).
I have a single sheet that lists available items, prices, etc. When doing quotes, you simply put y/n in Col:A for each item. I then want a simple macro that will copy all of the rows with "yes" into a second sheet. Sample data with end result attached.
I did try and butcher this macro to do what I want, and whilst it does copy data across, it's not really working. Firstly as I think it is searching along a row and copy columns, whereas I need to search a column and then copy rows.
Sub copyQuote()
Dim LC As Long, LR As Long, FC As Long, c As Range, rData As Range
Application.ScreenUpdating = False
LC = ActiveSheet.Range("A4").End(xlToLeft).Column
For Each c In Range(Cells(4, 2), Cells(4, LC))
If c.Value = "y" Then
FC = Sheets("License").Range("A4").End(xlToLeft).Offset(, 1).Column
Else
FC = 1
End If
LR = Cells(Rows.Count, c.Column).End(xlUp).Row
Set rData = Application.Union(c.Offset(1), c.Offset(13).Resize(LR - 5))
rData.Copy Sheets("Legrand").Cells(1, FC)
Next c
Application.ScreenUpdating = True
End Sub
Thanx in advance.
sample_data.xls
Bookmarks