Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Sub Increment()
  2.  
  3. Dim startValue
  4. startValue = Cells(15, 5).Value
  5.  
  6. For i = 1 To 10 Step 1
  7. Cells(i, 5).Value = startValue
  8. startValue = startValue + 1
  9. Next i
  10. End Sub
  11.  
  12. Sub tgr()
  13.  
  14. Dim ws As Worksheet
  15. Dim rDest As Range
  16. Dim lCount As Long
  17. Dim sValue As String
  18.  
  19. Set ws = ActiveWorkbook.ActiveSheet
  20. Set rDest = ws.Range("H3")
  21.  
  22. With ws.Range(rDest, ws.Cells(ws.Rows.Count, rDest.Column).End(xlUp))
  23. If .Row >= rDest.Row Then .ClearContents 'Clear previous results (if any)
  24. End With
  25.  
  26. lCount = Val(ws.Range("C3").Value)
  27. sValue = ws.Range("F3").Value
  28.  
  29. If lCount > 0 Then rDest.Resize(lCount) = sValue
  30.  
  31. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement