Hello,
I would like to ask you for help with my VBA code. I need to find value "Spec 012" in row 13 and if this value exists then it should save address of column and copy range 14:100 in that column. If sheet doesn't contain value "Spec 012" then do nothing. I have created this code so far:
Sub Copy_range() Dim r1 As Range Dim a1() As String Dim Col_1 As String Set r1 = ActiveSheet.Cells.Find("Spec. 012", LookIn:=xlValues, lookat:=xlWhole) If (Not IsEmpty(r1.Value)) And (Not IsError(r1.Value)) Then a1 = Split(r1.Address, "$") Col_1 = a1(1) End If Debug.Print Col_1 ActiveSheet.Range(Col_1 & "14:" & Col_1 & "100").Copy End Sub
If sheet contains value "Spec. 012" then it works fine but if doesn't then it gets an error. I know that problem is in IF condition, but I don't know how to fix it.
Sorry for lame question, but I am newbie in VBA.
Bookmarks