-1

This code does not run. I understand this well written. The error that appears is '' syntax error ''.

Dim Bt1 As String
Dim Bt2 As String
Sheets("Data").Select
Bt1 = Range("B2")
Bt2 = Range("C2")
Sheets("Data2").Select
Sheets("Data2").Range("B2").offset(1,0)<>"" then
Sheets("Data2").Range("C2").End(xlDown).Select
End If
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Bt1
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Bt1
Sheets("Data").Select
Sheets("Data").Range("B2").Select
End Sub
Community
  • 1
  • 1
  • That would probably be because you have a syntax error. – SierraOscar Apr 18 '16 at 18:48
  • It should be `If Sheets("Data2").Range("B2").offset(1,0)<>"" then`. You are missing the `If` at the beginning. – Ralph Apr 18 '16 at 18:48
  • Also look [HERE](http://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros) as a guide to avoid using `.select` and `.Activate` – Scott Craner Apr 18 '16 at 18:52

1 Answers1

1

It should be If Sheets("Data2").Range("B2").offset(1,0)<>"" Then. You are missing the If at the beginning of that line.

Jean-François Corbett
  • 36,032
  • 27
  • 135
  • 183