Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Code Refinement involving blank cell(s)

Nevermind. Fixed it. Yet another premature post. :

Robbyn
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to hide blank rows ub Excel Worksheet Functions 4 July 31st 08 01:44 PM
Average Formula to display blank cell if named range is blank Rachael F Excel Worksheet Functions 3 February 22nd 08 05:05 PM
COPY A CONCATENATE CELL TO BLANK CELL PUTTING IN THE NEXT BLANK C. QUEST41067 Excel Discussion (Misc queries) 1 January 15th 05 09:29 PM
Blank grey toolbar after code ! Static Bob Excel Programming 0 April 21st 04 01:38 PM
Code to go to last row (next blank row) miker1999[_7_] Excel Programming 8 February 7th 04 11:40 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"