Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm pretty new to VBA, but love the few things I have been able to do
so far . . . here's what I want to do now: I have a semi-colon delimited download from a program. I put it through the text-import wizzard and it imports to columns almost perfectly . . . Almost. Out of the 10,000 or so lines on the import, a handful were not delimited properly on the data dump. This is resulting in some of the data being shifted left either one or two columns. (see example below of the last three columns of my data dump) My pre-VBA solution was to filter the column AK by BLANK and then manually shift the data to the right one or two rows (whatever it needed). Now that I'm falling in love with VBA, i understand the time that automating this process could save. Here's what I'm trying to do in plain English For each row I want to If the contents of AJ are = 0 than do nothing, If the contents of AJ are blank "", then I want to shift the contents of Column T through AI two cells to the right Then I will do a similar loop through Column AK, with the only difference being If the contents of AI are blank "", then I want to shift the contents of Column U through AJ ONE cell to the right Here's what I've tried for the Column AJ loop: Sub MoveBadRows() 'This Sub is not good yet Range("aj2").Select Do While Selection.Offset(0, -1) < "" If IsEmpty(ActiveCell) Then Range(ActiveCell.Offset(0, -1):ActiveCell.Offset(0, -16)).Select Selection.Cut Destination:=ActiveCell.Offset(0, 2).Range("A1:P1") ActiveCell.Offset(1, 0).Select Else: ActiveCell.Offset(1, 0).Select End If Loop End Sub I know that my problems are : 1) In defining the range that is to be moved 2) Getting the active cell back a single cell in column AK AI AJ AK 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Note:My download always has 37 columns (AK) and varying number of rows. Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Rows are shifting slightly when printed | Excel Discussion (Misc queries) | |||
Deleting Rows and Shifting Up - Repost | Excel Discussion (Misc queries) | |||
Shifting rows into columns | Excel Discussion (Misc queries) | |||
Shifting the contents of cells | Setting up and Configuration of Excel | |||
Shifting Date from all data on one row to several rows | Excel Discussion (Misc queries) |