Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Refinement involving blank cell(s)
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Refinement involving blank cell(s)
Nevermind. Fixed it. Yet another premature post. :
Robbyn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA code to hide blank rows | Excel Worksheet Functions | |||
Average Formula to display blank cell if named range is blank | Excel Worksheet Functions | |||
COPY A CONCATENATE CELL TO BLANK CELL PUTTING IN THE NEXT BLANK C. | Excel Discussion (Misc queries) | |||
Blank grey toolbar after code ! | Excel Programming | |||
Code to go to last row (next blank row) | Excel Programming |