ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find row value, insert column (https://www.excelbanter.com/excel-programming/313893-find-row-value-insert-column.html)

gaba

find row value, insert column
 
Hi everybody!
I'm trying to create a loop for a range of rows, find certain value, insert
a column if there is a match and copy cells to that new column, if not a
match go to next

So far I have

Sub InsertColumns ()

Sheets("data").Range("G15").Select
'I need to check row 15 to end

Do
If ActiveCell.Offset(0, 0).Value = "QC Std 2" Then
ActiveCell.Offset(0, 0).Select
Selection.EntireColumn.Offset(0, 1).Insert
'Range("H78", "H88").Copy Destination:=ActiveCell.Offset(-7, 0)

ElseIf ActiveCell.Offset(0, 0).Value = "QC Std 3" Then
ActiveCell.Offset(0, 0).Select
Selection.EntireColumn.Offset(0, 1).Insert

Else
'do nothing, go to next

End If

ActiveCell.Offset(0, 1).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 0))
End Sub

Any help will be more than appreciated!
--
gaba :)


All times are GMT +1. The time now is 10:37 AM.

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