Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've got an almost 1800 line spreadsheet in Excel. I've got to manipulate
data in it for a client. I'm needing to do the following in Excel 1. begin searching at the top of the file 2. check the check / manipulate the contents of 3 adjacent columns, ie: ____________ | A | B | C | ---------------- | | X | Y | ---------------- | | X | | ---------------- | | | | ---------------- | | X | | ---------------- | | X | Y | ---------------- 3. column A is always blank 4. if column C has data in it, then 4a. move column B data to column A 4b. move column C data to column B ____________ | A | B | C | ---------------- | X | Y | | ---------------- | | X | | ---------------- | | | | ---------------- | | X | | ---------------- | X | Y | | ---------------- 5. continue searching from the current location until the end of the file Any takers on this one? Otherwise, I'm gonna have to hand move 2 cells of data almost 1700 times. Thanks, -- Brad S. Russell Network / Systems Engineer Datamax Micro 501-603-3077 (office) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub brad()
n = Cells(Rows.Count, "C").End(xlUp).Row For i = 1 To n If IsDate(Cells(i, 3).Value) Then Cells(i, 1).Value = Cells(i, 2).Value Cells(i, 2).Value = Cells(i, 3).Value Cells(i,3).Clear End If Next End Sub -- Gary''s Student gsnu200711 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Didn't Think there was a mention of dates
Sub brad2() n = Cells(Rows.Count, "C").End(xlUp).Row For i = 1 To n If Cells(i, 3).Value < "" Then Cells(i, 1).Value = Cells(i, 2).Value Cells(i, 2).Value = Cells(i, 3).Value Cells(i,3).Value = "" End If Next End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well, I've tried it and it didn't work. This is the macro that I'm
running... Sub brad2() n = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To n If Cells(i, 3).Value < "" Then Cells(i, 1).Value = Cells(i, 2).Value Cells(i, 2).Value = Cells(i, 3).Value Cells(i, 3).Value = "" End If Next End Sub One note, I was wrong on the columns...they are G H and I So the posed problem is below. ____________ | G | H | I | ---------------- | | X | Y | ---------------- | | X | | ---------------- | | | | ---------------- | | X | | ---------------- | | X | Y | ---------------- 3. column G is always blank 4. if column I has data in it, then 4a. move column H data to column G 4b. move column I data to column H ____________ | G | H | I | ---------------- | X | Y | | ---------------- | | X | | --------------- | | | | --------------- | | X | | --------------- | X | Y | | --------------- -- Blaster Master a.k.a. Brad S. Russell |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
well, i'll give it a shot (but you may wish i hadn't).....
Sub brad2() Dim ws As Worksheet Set ws = ActiveSheet ws.Range("g1").Select Do Until ActiveCell = "" And _ ActiveCell.Offset(0, 1) = "" And _ ActiveCell.Offset(0, 2) = "" If ActiveCell = "" Then Selection.Delete Shift:=xlToLeft ActiveCell.Offset(1, 0).Select Else ActiveCell.Offset(1, 0).Select End If Loop End Sub well, it's sloppy & may be a little slow & isn't coded perfectly, but it works for me........ :) susan On Mar 26, 1:20 pm, "Blaster Master" wrote: Well, I've tried it and it didn't work. This is the macro that I'm running... Sub brad2() n = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To n If Cells(i, 3).Value < "" Then Cells(i, 1).Value = Cells(i, 2).Value Cells(i, 2).Value = Cells(i, 3).Value Cells(i, 3).Value = "" End If Next End Sub One note, I was wrong on the columns...they are G H and I So the posed problem is below. ____________ | G | H | I | ---------------- | | X | Y | ---------------- | | X | | ---------------- | | | | ---------------- | | X | | ---------------- | | X | Y | ---------------- 3. column G is always blank 4. if column I has data in it, then 4a. move column H data to column G 4b. move column I data to column H ____________ | G | H | I | ---------------- | X | Y | | ---------------- | | X | | --------------- | | | | --------------- | | X | | --------------- | X | Y | | --------------- -- Blaster Master a.k.a. Brad S. Russell |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
REVISION
was checking wrong column........ Sub brad2() Dim ws As Worksheet Set ws = ActiveSheet ws.Range("i1").Select Do Until ActiveCell = "" And _ ActiveCell.Offset(0, -1) = "" And _ ActiveCell.Offset(0, -2) = "" If ActiveCell < "" Then ActiveCell.Offset(0, -2).Delete Shift:=xlToLeft ActiveCell.Offset(1, 0).Select Else ActiveCell.Offset(1, 0).Select End If Loop End Sub susan On Mar 27, 7:58 am, "Susan" wrote: well, i'll give it a shot (but you may wish i hadn't)..... Sub brad2() Dim ws As Worksheet Set ws = ActiveSheet ws.Range("g1").Select Do Until ActiveCell = "" And _ ActiveCell.Offset(0, 1) = "" And _ ActiveCell.Offset(0, 2) = "" If ActiveCell = "" Then Selection.Delete Shift:=xlToLeft ActiveCell.Offset(1, 0).Select Else ActiveCell.Offset(1, 0).Select End If Loop End Sub well, it's sloppy & may be a little slow & isn't coded perfectly, but it works for me........ :) susan On Mar 26, 1:20 pm, "Blaster Master" wrote: Well, I've tried it and it didn't work. This is the macro that I'm running... Sub brad2() n = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To n If Cells(i, 3).Value < "" Then Cells(i, 1).Value = Cells(i, 2).Value Cells(i, 2).Value = Cells(i, 3).Value Cells(i, 3).Value = "" End If Next End Sub One note, I was wrong on the columns...they are G H and I So the posed problem is below. ____________ | G | H | I | ---------------- | | X | Y | ---------------- | | X | | ---------------- | | | | ---------------- | | X | | ---------------- | | X | Y | ---------------- 3. column G is always blank 4. if column I has data in it, then 4a. move column H data to column G 4b. move column I data to column H ____________ | G | H | I | ---------------- | X | Y | | ---------------- | | X | | --------------- | | | | --------------- | | X | | --------------- | X | Y | | --------------- -- Blaster Master a.k.a. Brad S. Russell- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
data manipulation question | Excel Worksheet Functions | |||
Basic (I think) string manipulation question.. | Excel Programming | |||
csv manipulation question | Excel Discussion (Misc queries) | |||
Range Manipulation Question | Excel Programming | |||
Date manipulation question | Excel Programming |