0

I am trying to pick up a column from a sheet and delete the Column whenever a new entry is made in the textbox.

Private Sub Ent_TextBox_Change()

Dim Wk As Workbook

Dim Ws As Worksheet


Set Wk = ActiveWorkbook

Set Ws = Wk.Sheets("Main")

Ws.Activate

SearchValue = Ent_TextBox.Value

NumberofCharacters = Len(SearchValue)

lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row

Sheets("Data").Activate

Columns("B:B").Select ' Not picking up this column - Causing error'

Selection.Delete Shift:=xlToLeft

End Sub

Any Suggestions, Why it is not selecting that particular column?

1 Answers1

1

Instead of

Sheets("Data").Activate
Columns("B:B").Select ' Not picking up this column - Causing error'
Selection.Delete Shift:=xlToLeft

Try

Sheets("Data").Columns("B:B").Delete Shift:=xlToLeft
RADO
  • 7,733
  • 3
  • 19
  • 33