ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If B4 =? enter 1 in A4 (https://www.excelbanter.com/excel-programming/294637-if-b4-%3D-enter-1-a4.html)

Blue

If B4 =? enter 1 in A4
 
Hi

What I would like to do is

Starting at B4, if B4 has a number in it enter 1 in column A row same as B
repeat to end of column B

Thanks in advance

Blue



Frank Kabel

If B4 =? enter 1 in A4
 
Hi
enter the following in A4
=IF(ISNUMBER(B4),B4,"")
and copy down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany


Blue wrote:
Hi

What I would like to do is

Starting at B4, if B4 has a number in it enter 1 in column A row same
as B repeat to end of column B

Thanks in advance

Blue



Blue

If B4 =? enter 1 in A4
 
Thanks for the reply Frank

I want to do this in code so I can use it in various spreadsheet without
having to do it manually, ie Run macro ???? and it enters 1 in A if B=?

Thanks

Blue


"Frank Kabel" wrote in message
...
Hi
enter the following in A4
=IF(ISNUMBER(B4),B4,"")
and copy down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany




Frank Kabel

If B4 =? enter 1 in A4
 
Hi
don't know why you want a macro for this but try something like the
following
Sub change_b()
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).row
For RowNdx = LastRow To 4 Step -1
with Cells(RowNdx, "B")
if isnumeric(.value) then
.offset(0,-1).value = .value
End If
end with
Next RowNdx
Application.ScreenUpdating = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


Blue wrote:
Thanks for the reply Frank

I want to do this in code so I can use it in various spreadsheet
without having to do it manually, ie Run macro ???? and it enters 1
in A if B=?

Thanks

Blue


"Frank Kabel" wrote in message
...
Hi
enter the following in A4
=IF(ISNUMBER(B4),B4,"")
and copy down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany



Ron de Bruin

If B4 =? enter 1 in A4
 
Try this

Sub test()
Columns("B").SpecialCells(xlCellTypeConstants, _
xlNumbers).Offset(0, -1).Value = 1
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Blue" wrote in message ...
Thanks for the reply Frank

I want to do this in code so I can use it in various spreadsheet without
having to do it manually, ie Run macro ???? and it enters 1 in A if B=?

Thanks

Blue


"Frank Kabel" wrote in message
...
Hi
enter the following in A4
=IF(ISNUMBER(B4),B4,"")
and copy down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany






Blue

If B4 =? enter 1 in A4
 
Frank and Ron thanks for the quick replies

Frank changed .offset(0,-1).value = .value to .offset(0,-1).value = 1
This gave the answer I wanted.

Ron your code worked great as well.

Thanks to you both

Blue




All times are GMT +1. The time now is 06:55 AM.

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