Football lines

speedracer7278

New Member
Joined
Aug 24, 2007
Messages
3
I would like: If value in power cell are negative to convert them to positive and move up to Visiting team? Example move and change Atlanta Power 3 from -2 into 2 and move up to Carolina cell just above. Same for entire worksheet single function. Thanks for having this site. I have been off excel for 16 years and things have changed.
Casino linePower 1Power2Power 3
451​
Detroit
452​
Kansas City
4​
11.5​
7.5​
5​
453​
Carolina
454​
Atlanta
3.5​
9​
2.5​
-2​
455​
Houston
456​
Baltimore
10​
10​
7.5​
11​
457​
Cincinnati
458​
Cleveland
-2​
6​
1​
-7​
459​
Jacksonville
460​
Indianapolis
-5​
3​
0​
-13​
461​
Tampa Bay
462​
Minnesota
6​
3​
4.5​
7.5​
463​
Tennessee
464​
New Orleans
3.5​
7.5​
6.5​
8​
 
Last edited by a moderator:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Welcome to the Board!

So is this what you are looking for (updated values in red)?

1694424551125.png


Here is VBA code that will do that:
VBA Code:
Sub MyMacro()

    Dim lr As Long
    Dim r As Long
    Dim c As Long
    
    Application.ScreenUpdating = False
    
'   Find last row in column A with data
    lr = Cells(Rows.Count, "A").End(xlUp).Row
    
'   Loop through all rows and columns
    For r = 2 To lr
        For c = 3 To 6
'           If value is less than zero, copy postitive value to line above
            If Cells(r, c).Value < 0 Then
                Cells(r - 1, c).Value = 0 - Cells(r, c).Value
'               Uncomment following line if you want to remove negative
                'Cells(r, c).ClearContents
            End If
        Next c
    Next r
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0
Solution
I anticipated that. Did you see this part of my code?
VBA Code:
'               Uncomment following line if you want to remove negative
                'Cells(r, c).ClearContents
Remove the single quote mark so it looks like this:
VBA Code:
'               Uncomment following line if you want to remove negative
                Cells(r, c).ClearContents
and it should do what you want.
 
Upvote 0
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,217,240
Messages
6,135,430
Members
449,932
Latest member
sbog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top