PE New User
New Member
- Joined
- Aug 4, 2014
- Messages
- 21
Hi,
I am trying to do something that I thought would be quite simple, but seem to keep stumbling.
I have a spreadsheet of multiple columns and am copying and pasting text from one tab to another, but in the new tab I only need a certain number of columns. I have written the syntax to delete most of the columns, but am coming unstuck with trying to get rid of the last columns to the right of the data.
I can find the column that I need to remove (using Cells.Find) and highlight the entire column, but cannot get the syntax right to select all further columns to the right. Have tried the following, but can someone point out where I have gone wrong or suggest another way of achieving the desired result:
I am trying to do something that I thought would be quite simple, but seem to keep stumbling.
I have a spreadsheet of multiple columns and am copying and pasting text from one tab to another, but in the new tab I only need a certain number of columns. I have written the syntax to delete most of the columns, but am coming unstuck with trying to get rid of the last columns to the right of the data.
I can find the column that I need to remove (using Cells.Find) and highlight the entire column, but cannot get the syntax right to select all further columns to the right. Have tried the following, but can someone point out where I have gone wrong or suggest another way of achieving the desired result:
Code:
Cells.Find(What:="kVa Rate(£/kVA)", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Select
ActiveCell.EntireColumn.Select
Range(ActiveCell, Column.End(x1ToRight)).Select
Selection.Delete