Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
How do I write the code for the following. I need a vba to look up the value in column "a" on a sheet called "reg". If the cells value is greater than 1 i need in column "g" to input this code . =IF(A2 500,"yes","no") I want this to show the row number it is on instead of "a2" it might be a31 or something Any help would be great as I have no idea how to do this Thanks Greg |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just a follow on i need it to do it for all the rows in the worksheet.
Thanks again greg "Greg" wrote in message ... Hi all, How do I write the code for the following. I need a vba to look up the value in column "a" on a sheet called "reg". If the cells value is greater than 1 i need in column "g" to input this code . =IF(A2 500,"yes","no") I want this to show the row number it is on instead of "a2" it might be a31 or something Any help would be great as I have no idea how to do this Thanks Greg |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Greg,
Try: '============= Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim rng As Range Dim rCell As Range Set WB = Workbooks("YourWorkbook.xls") '<<==== CHANGE Set SH = WB.Sheets("reg") Set rng = Intersect(SH.UsedRange, SH.Columns("A")) For Each rCell In rng.Cells With rCell If IsNumeric(.Value) And .Value 1 Then rCell(1, 7).FormulaR1C1 = _ "=IF(RC[-6] 500,""yes"",""no"")" End If End With Next rCell End Sub '<<============= --- Regards, Norman "Greg" wrote in message ... Just a follow on i need it to do it for all the rows in the worksheet. Thanks again greg "Greg" wrote in message ... Hi all, How do I write the code for the following. I need a vba to look up the value in column "a" on a sheet called "reg". If the cells value is greater than 1 i need in column "g" to input this code . =IF(A2 500,"yes","no") I want this to show the row number it is on instead of "a2" it might be a31 or something Any help would be great as I have no idea how to do this Thanks Greg |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for that Norman
Greg "Norman Jones" wrote in message ... Hi Greg, Try: '============= Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim rng As Range Dim rCell As Range Set WB = Workbooks("YourWorkbook.xls") '<<==== CHANGE Set SH = WB.Sheets("reg") Set rng = Intersect(SH.UsedRange, SH.Columns("A")) For Each rCell In rng.Cells With rCell If IsNumeric(.Value) And .Value 1 Then rCell(1, 7).FormulaR1C1 = _ "=IF(RC[-6] 500,""yes"",""no"")" End If End With Next rCell End Sub '<<============= --- Regards, Norman "Greg" wrote in message ... Just a follow on i need it to do it for all the rows in the worksheet. Thanks again greg "Greg" wrote in message ... Hi all, How do I write the code for the following. I need a vba to look up the value in column "a" on a sheet called "reg". If the cells value is greater than 1 i need in column "g" to input this code . =IF(A2 500,"yes","no") I want this to show the row number it is on instead of "a2" it might be a31 or something Any help would be great as I have no idea how to do this Thanks Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count Employee Work Time - Don't Count Duplicates | Excel Worksheet Functions | |||
Count Employee Work Time - Don't Double-count Overlapping Apts. | Excel Worksheet Functions | |||
Excel 2000, count, sort a list & count totals? | Excel Worksheet Functions | |||
How do i count numbers and letters to find a total count of all | Excel Worksheet Functions | |||
Count Intervals of Filtered TEXT values in Column and Return Count across a Row | Excel Worksheet Functions |