ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Filtering and replacing values through a macro (https://www.excelbanter.com/excel-worksheet-functions/10333-filtering-replacing-values-through-macro.html)

vic

Filtering and replacing values through a macro
 
Coding Help!

I have spreadsheet where column A is company, column B is user, and column C
is area.

If column A, Row1 equals 18 and Column C, Row 1 equals "FLA" then Column B
row 1 is replace with "BILL". I want it to continue until it reaches the
last row.

Thanks for your help!!!!!

Jason Morin

In a standard module:

Sub InsertBill()
Dim cell As Range
Dim ActiveWS As Worksheet
Dim iLastRow As Long
Set ActiveWS = ActiveWorkbook.ActiveSheet
iLastRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each cell In ActiveWS.Range("A1:A" & iLastRow)
With cell
If .Value = 18 And _
.Offset(0, 2).Value = "FLA" Then
.Offset(0, 1).Value = "Bill"
End If
End With
Next
End Sub


---
HTH
Jason
Atlanta, GA

-----Original Message-----
Coding Help!

I have spreadsheet where column A is company, column B

is user, and column C
is area.

If column A, Row1 equals 18 and Column C, Row 1

equals "FLA" then Column B
row 1 is replace with "BILL". I want it to continue

until it reaches the
last row.

Thanks for your help!!!!!
.



All times are GMT +1. The time now is 02:32 PM.

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