Transfering Info Stop When Null

  • Thread starter Thread starter Ardy
  • Start date Start date
A

Ardy

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
 
Can we do a Volcan Brain melt, So I can aquire some of your knowledge
quickly :)

Thanks It works perfect.

Tom said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top