Private Sub Layout_populate__buttn_Click()
Application.ScreenUpdating = False ' Temporarily Disable Screen Updating:
' Define Variables:
' ========================================================
' Worksheets:
' ------------
Dim Main_populated__sheet As Worksheet ' Main (current) worksheet to work off of
Dim Linear_Interpolation_1__sheet As Worksheet ' Sheet that data is saved onto and to be worked with in this example
' Iterators:
' ------------
Dim Count_i As Integer ' Loop position in Cartesian x-direction
Dim Count_j As Integer ' Loop Position in Cartesian y-direction
Dim Iterator_placement_A As Integer ' Iterator defined during the main code run
' Other Variables defined in the rest of the code:
' ----------------------------------------------
Dim Selection_total_range As Integer
Dim Column_A As Integer
Dim Column_B As Integer
' Initialize Variables:
' ========================================================
Linear_Interpolation_1__sheet = Sheets("Linear_Interpolation_1")
Count_i = 0
Count_j = 0
' The following are defined in the code prior to this point,
' eliminating a .Range("X#:Y#") solution
' --------------------------------------------------
Iterator_placement_A = 16
Selection_total_range = 177
Column_A = 2 ' Column "B"
Column_B = 6 ' Column "G"
' Fill Empty Cells with Zeroes:
' ========================================================
With Linear_Interpolation__sheet_1 ' Select Worksheet to do work on
For Count_i = Column_A To Column_B ' Columns to loop through
For Count_j = Iterator_placement_A To Selection_total_range Step 1 ' Rows to loop through
If Linear_Interpolation__sheet_1.Range(Cells(Count_j, Count_i)).txt = "" Then
Linear_Interpolation__sheet_1.Range(Cells(Count_j, Count_i)).Value = 0
' If cell looked at is blank, fill it with a zero
End If
Next Count_j
Next Count_i
End With
' Re-Enable Screen Updating:
' =====================================================
Application.ScreenUpdating = True
End Sub
Bookmarks