Advertisement
jdelano

Untitled

Jan 30th, 2025
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     Dim lastRow As Long
  2.     Dim sheetRow As Long
  3.    
  4.     ' find the last rows that contains data in column A
  5.    lastRow = Sheet1.Cells(Sheet1.Rows.Count, "A").End(xlUp).Row
  6.    
  7.     ' loop through the rows that have data
  8.    For sheetRow = 1 To lastRow
  9.    
  10.         'sets unideal court numbers from cell entry
  11.        ' use the sheetrow variable to create the
  12.        Unideal1 = Sheet1.Cells(sheetRow, "G").Value
  13.         Unideal2 = Sheet1.Cells(sheetRow, "H").Value
  14.        
  15.         'sets games from cell entry
  16.        strGames = Sheet1.Cells(sheetRow, "B").Value
  17.        
  18.         'sets court numbers from cell entry
  19.        strCourts1 = Sheet1.Cells(sheetRow, "A").Value
  20.        
  21.         ' do the rest of your code ....
  22.        ' you'll want to look at creating a sub procedure to pass these values into
  23.        ' and have it do the work so that this loop isn't cluttered
  24.    
  25.     Next sheetRow
Tags: vba
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement