ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Switch Signs (https://www.excelbanter.com/excel-programming/356077-switch-signs.html)

Steph[_6_]

Switch Signs
 
Hi everyone. I have a large block of data. In column A is an account
number. In columns B thru Z is numerical data. Is there a way to
programatically scan column A, and if the last 4 characters in the contents
of column A are 888Z, then change the sign of the numbers in columns B thru
Z of the same row? Thanks in advance!



[email protected]

Switch Signs
 
Sub ChangeSign()
Dim i As Long
Dim j As Long

For i = 1 To Range("A65536").End(xlUp).Row 'For each row
If Right(Cells(i, 1), 4) = "888Z" Then
For j = 2 To 26
Cells(i, j) = -Cells(i, j)
Next j
End If
Next i
End Sub

On Wed, 15 Mar 2006 09:38:35 -0500, "Steph" wrote:

Hi everyone. I have a large block of data. In column A is an account
number. In columns B thru Z is numerical data. Is there a way to
programatically scan column A, and if the last 4 characters in the contents
of column A are 888Z, then change the sign of the numbers in columns B thru
Z of the same row? Thanks in advance!




All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com