PC Review


Reply
Thread Tools Rate Thread

data manipulation question

 
 
Blaster Master
Guest
Posts: n/a
 
      22nd Mar 2007
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)


 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      22nd Mar 2007
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


 
Reply With Quote
 
excel-ant
Guest
Posts: n/a
 
      22nd Mar 2007
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

 
Reply With Quote
 
Blaster Master
Guest
Posts: n/a
 
      26th Mar 2007
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


 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      27th Mar 2007
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" <bsr...@sbcglobal.net> 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



 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      27th Mar 2007
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" <bogenex...@aol.com> 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" <bsr...@sbcglobal.net> 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 With Quote
 
Blaster Master
Guest
Posts: n/a
 
      27th Mar 2007
I want to thank you for trying, but it moved everything in the column.

I'm needing it to move the contents of column H to column G, and column I to
column H

if and only if there is something in column I

otherwise it should skip that line

--


Blaster Master
a.k.a.
Brad S. Russell


"Susan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <bogenex...@aol.com> 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" <bsr...@sbcglobal.net> 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 With Quote
 
Susan
Guest
Posts: n/a
 
      27th Mar 2007
ahhhhh... i wasn't considering that there was other data in subsequent
columns! i was using delete to accomplish the task, but i can see
where that doesn't work, then.

back to square one..... although the concept should work (it did for
me - skipped that row when i was blank), you just need to change
ActiveCell.Offset(0, -2).Delete Shift:=xlToLeft
to whatever you can figure out about the moving the contents.

sorry!
susan



On Mar 27, 1:44 pm, "Blaster Master" <bsr...@sbcglobal.net> wrote:
> I want to thank you for trying, but it moved everything in the column.
>
> I'm needing it to move the contents of column H to column G, and column I to
> column H
>
> if and only if there is something in column I
>
> otherwise it should skip that line
>
> --
>
> Blaster Master
> a.k.a.
> Brad S. Russell
>




 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      28th Mar 2007
brad -
was thinking about this in my sleep (!) & also thought that perhaps
the skipping rows didn't work for you because your "empty" cells are
not truly empty - do they have formulas in them?
just another thought.
susan


On Mar 27, 1:51 pm, "Susan" <bogenex...@aol.com> wrote:
> ahhhhh... i wasn't considering that there was other data in subsequent
> columns! i was using delete to accomplish the task, but i can see
> where that doesn't work, then.
>
> back to square one..... although the concept should work (it did for
> me - skipped that row when i was blank), you just need to change
> ActiveCell.Offset(0, -2).Delete Shift:=xlToLeft
> to whatever you can figure out about the moving the contents.
>
> sorry!
> susan
>
> On Mar 27, 1:44 pm, "Blaster Master" <bsr...@sbcglobal.net> wrote:
>
>
>
> > I want to thank you for trying, but it moved everything in the column.

>
> > I'm needing it to move the contents of column H to column G, and column I to
> > column H

>
> > if and only if there is something in column I

>
> > otherwise it should skip that line

>
> > --

>
> > Blaster Master
> > a.k.a.
> > Brad S. Russell- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
data manipulation question Blaster Master Microsoft Excel Worksheet Functions 3 22nd Mar 2007 08:39 PM
Easy (I think) question about data manipulation in MS Access =?Utf-8?B?TmVyZG9waGlsZQ==?= Microsoft Access 2 2nd Mar 2006 01:10 PM
csv manipulation question fally Microsoft Excel Misc 1 9th Oct 2005 12:58 PM
Data manipulation Question pmclinn Microsoft VB .NET 6 14th Jan 2005 03:57 AM
Data manipulation question =?Utf-8?B?VHJpc2hhIEIu?= Microsoft Access Forms 2 27th Sep 2004 03:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:36 AM.