Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default data manipulation question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default data manipulation question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default data manipulation question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default data manipulation question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default data manipulation question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default data manipulation question

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
data manipulation question Blaster Master Excel Worksheet Functions 3 March 22nd 07 08:39 PM
Basic (I think) string manipulation question.. Chris Ashley Excel Programming 1 October 26th 05 03:27 PM
csv manipulation question fally Excel Discussion (Misc queries) 1 October 9th 05 12:58 PM
Range Manipulation Question [email protected] Excel Programming 2 April 5th 05 11:20 PM
Date manipulation question NikkoW Excel Programming 2 May 14th 04 04:17 PM


All times are GMT +1. The time now is 10:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"