Code Refinement involving blank cell(s)

R

Robbyn

I use the following code snippet to create individual student reports from my gradebook. The code copies grades from the worksheet onto a report created using vba. Sometimes the cell which contains the student's first grade is empty, so I need the first grade on the report to be empty. I just can't figure out how to get the code to reflect that. Any advice would be appreciated

Private Sub OKButton_Click(
Dim RowRange As Rang
Dim RowCnt As Intege
Dim r As Intege
Dim wsNew As Workshee
Dim wsSource As Workshee
Dim rng As Rang
Dim myCmt As Commen


Application.ScreenUpdating = Fals
Set wsSource = ActiveShee
RowCnt =
For r = 0 To ListBox1.ListCount - 1 'Count student row
If ListBox1.Selected(r) The
RowCnt = RowCnt +
Set RowRange = ActiveSheet.Range("A15").Rows(r + 1
End I
Next

RowRange.Select 'Copy student grade
Set LeftCell = Cells(ActiveCell.Row, 8
Set RightCell = Cells(ActiveCell.Row, 256

Set LeftCell = LeftCell.End(xlToRight
Set RightCell = RightCell.End(xlToLeft
If LeftCell.Column = 256 And RightCell.Column = 8 Then ActiveCell.Selec
Set rng = Range(LeftCell, RightCell
rng.Cop

Set wsNew = Worksheets.Add 'Paste student grades to Report
wsNew.Name = "Report" & UserForm1.ListBox1.Valu
With wsNew.Range("f14"
.PasteSpecial Paste:=xlPasteValues, Transpose:=Tru
End Wit

Thanks for your help

Robbyn
 

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

Top