ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Transfering Info Stop When Null (https://www.excelbanter.com/excel-programming/380933-transfering-info-stop-when-null.html)

Ardy

Transfering Info Stop When Null
 
Hello All:
I am trying to transfer some data from Column A in Tab A to Column A in
TAB B. I also Am trying to make the code stop if it encounters null.
Meaning don't auto fill, but not having any luck. Can somebody take
a look at the code and put me in the right direction or tell me what I
have done wrong.
---------------------------
Sub StudentNameTransfer()
Sheets("PA-DWR Detail").Select
' ActiveWorkbook.Worksheets("Roster").Unprotect "LasAnimas"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=(Roster!R[-1]C)" ' This is the first
name
' I like to stop the autofill if it hits a null from the other tab
in another word if it is null it will 'transfer a 0 I just assume it
stops because it means we don't have any data

With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("A3:A44").AutoFill Destination:=.Range("A3:A" & LastRow), _
Type:=xlFillDefault
End With
Sheets("Roster").Select
Range("B2").Select
End Sub
---------------------------
Thanks


Ardy

Transfering Info Stop When Null
 
Can we do a Volcan Brain melt, So I can aquire some of your knowledge
quickly :)

Thanks It works perfect.

Tom Ogilvy wrote:
Sub StudentNameTransfer()
Dim lastrow as long
With Worksheets("Roster")
lastrow = .cells(rows.count,1).End(xlup).row
End With
With Sheets("PA-DWR Detail")
.Range("A3").Resize(lastrow-1,1).FormulaR1C1 _
= "=(Roster!R[-1]C)"
End With
End Sub
--
Regards,
Tom Ogilvy


"Ardy" wrote:

Hello All:
I am trying to transfer some data from Column A in Tab A to Column A in
TAB B. I also Am trying to make the code stop if it encounters null.
Meaning don't auto fill, but not having any luck. Can somebody take
a look at the code and put me in the right direction or tell me what I
have done wrong.
---------------------------
Sub StudentNameTransfer()
Sheets("PA-DWR Detail").Select
' ActiveWorkbook.Worksheets("Roster").Unprotect "LasAnimas"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=(Roster!R[-1]C)" ' This is the first
name
' I like to stop the autofill if it hits a null from the other tab
in another word if it is null it will 'transfer a 0 I just assume it
stops because it means we don't have any data

With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("A3:A44").AutoFill Destination:=.Range("A3:A" & LastRow), _
Type:=xlFillDefault
End With
Sheets("Roster").Select
Range("B2").Select
End Sub
---------------------------
Thanks





All times are GMT +1. The time now is 11:13 PM.

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