supercrewed
Board Regular
- Joined
- Apr 9, 2010
- Messages
- 86
Below is my code to take a range and place onto another sheet. What i'd like to do is to put the range in an array, and then do the calculations in the code, rather than just copying the range from one range to another. The code below works, but i'm relying on the calculations from the worksheet, and i don't want to do this.
My data range is (A1:A175), from the Data sheet. I'm having trouble loading the array, and the accessing it to do the calculations.
Any help to get started would be great, Thanks in advance.
My data range is (A1:A175), from the Data sheet. I'm having trouble loading the array, and the accessing it to do the calculations.
Any help to get started would be great, Thanks in advance.
Code:
Option Explicit
Sub DATA_24288368()
Dim i As Integer
Dim r As Range
Dim j As Integer
Dim MinMax, JobNumber, SerialNumber As String
Dim LastRow As Long
Sheets("Inspection_Data").Activate
LastRow = Cells(Rows.Count, "I").End(xlUp).Row + 1
ActiveSheet.Cells(LastRow, 9).Select
Set r = Range("I" & LastRow)
Do
JobNumber = InputBox("Enter Job Number!", "Input Required")
If StrPtr(JobNumber) = 0 Then Exit Sub
Loop While Len(JobNumber) = 0 Or IsNumeric(JobNumber) = False
r.Offset(0, -2) = JobNumber
Do
SerialNumber = InputBox("Enter Serial Number!", "Input Required")
If StrPtr(SerialNumber) = 0 Then Exit Sub
Loop While Len(SerialNumber) = 0 Or IsNumeric(SerialNumber) = False
r.Offset(0, -6) = SerialNumber
For i = 0 To 33
r.Offset(0, i + j) = Sheets("Data").Range("B" & i + 1)
If i = 26 Then j = 4
If i = 28 Then j = 5
If i = 29 Then j = 6
Next
r.Offset(0, 43) = Sheets("Data").Range("B35")
'**************************************************************************************
MsgBox ("Data will be deleted from Data Sheet"), vbCritical, "Data Being Deleted"
Sheets("Data").Activate
Range("A:A").ClearContents
End Sub
Last edited: