Loopy Question?

Gastank

New Member
Joined
Feb 17, 2002
Messages
32
can someone explain if the following is possible. Automatically work down a column (say C) which would be an unknown range, and if the content is Saturday, then copy the contents of column A into column B then change the contents of column A to "0.00"

Before

A B C
1 5 0 Monday
2 5 0 Saturday
3 4 0 Tuesday

After

A B C
1 5 0 Monday
2 0 5 Saturday
3 4 0 Tuesday
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

al_b_cnu

Well-known Member
Joined
Jul 18, 2003
Messages
4,494
Hi,

how about this macro:
Code:
Sub xxx()
Dim R As Range
Dim WS As Worksheet

Set WS = Sheets("Sheet1")
For Each R In WS.Range("C2:C" & WS.Cells(Rows.Count, "C").End(xlUp).Row)
    If R.Text = "Saturday" Then
        R.Offset(0, -1).Value = R.Offset(0, -2).Value
        R.Offset(0, -2).Value = 0
    End If
Next R
End Sub
To install, [Alt-F11] Insert / module & paste into code window.
 

Watch MrExcel Video

Forum statistics

Threads
1,119,139
Messages
5,576,308
Members
412,716
Latest member
thviid
Top