Advertisement
Guest User

Untitled

a guest
Sep 11th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.06 KB | None | 0 0
  1.  
  2. Function Julie(sheetName As String, firstColumn As String, columnCount As Integer, firstRow As Integer, rowCount As Integer, dstFirstRow As Integer, dstFirstCol As String)
  3.    
  4.     Dim firstColumn_int As Integer
  5.     Dim lastColumn_int As Integer
  6.     Dim temporaryRow As Integer
  7.     Dim temporaryCol_int As Integer
  8.     Dim templateText As String
  9. 'Dim level As Long
  10.     Dim count As Integer
  11.     Dim dstFirstCol_int As Integer
  12.     Dim firstRow_int As Integer
  13.     Dim destinationColumn As Integer
  14.     Dim containsCharacters As Boolean
  15.    
  16.    
  17.    
  18.     count = 0
  19.    
  20.     firstColumn_int = Convert_Column_ToNumber(firstColumn)
  21.     dstFirstCol_int = Convert_Column_ToNumber(dstFirstCol)
  22.     lastColumn_int = firstColumn_int + columnCount
  23.     firstRow_int = dstFirstRow
  24.    
  25.     For temporaryRow = firstRow To firstRow + rowCount - 1
  26.         count = 1
  27.        
  28.         For temporaryCol_int = firstColumn_int To lastColumn_int - 1
  29.             containsCharacters = False
  30.             templateTxt = Sheets(sheetName).Cells(temporaryRow, temporaryCol_int).Value
  31.             If Not IsEmpty(templateTxt) Then
  32.                 ' daca count <= 5, atunci crestem dstFirstCol cu 1
  33.                 ' daca count >= 6, crestem cu lastColumn_int - 1 - count
  34.                
  35.                 destinationColumn = computeColumn(dstFirstCol_int, count)
  36.                
  37.                
  38.                 Sheets(sheetName).Cells(firstRow_int, dstFirstCol_int).Value = count
  39.            
  40.                 Sheets(sheetName).Cells(firstRow_int, destinationColumn).Value = templateTxt
  41.            
  42.             End If
  43.         count = count + 1
  44.         Next
  45.         firstRow_int = firstRow_int + 1
  46.        
  47.     Next
  48.    
  49.    
  50. End Function
  51.  
  52. Function computeColumn(firstColumnNo As Integer, count As Integer) As Integer
  53.     If (count <= 5) Then
  54.         computeColumn = firstColumnNo + 1
  55.         Exit Function
  56.     Else
  57.         computeColumn = firstColumnNo + (count - 5) + 1
  58.     End If
  59. End Function
  60.  
  61.  
  62. Sub Functie()
  63. Call Julie(AnalogSwitchesSheet, "AB", 7, 28, 30, 28, "T")
  64. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement