Sto cercando di creare un codice che possa ordinare, cercare e copiare dati da un set di dati che sta cambiando. Penso di aver bisogno di definire una variabile, quindi fare in modo che il codice trovi le coordinate per la variabile e poi procedere, ma ciò potrebbe essere completamente sbagliato. Ho incluso l'idea di base di cosa ho bisogno del codice da fare all'interno del codice, ma non conosco la sintassi per farlo funzionare. qualche idea?
Sub Organize_Data ()
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim X As Integer
Dim Function_Name As String
Replace_Blank
'******Next line could use some "robusting" by replacing hard coded value with a search for EE status**************
A = ActiveWorkbook.Worksheets("Raw Data").Range("F2", Worksheets("Raw Data").Range("F2").End(xlDown)).Rows.Count
Worksheets.Add().Name = "Calculations"
Find_Unit
Find_Locations
B = ActiveWorkbook.Worksheets("Calculations").Range("B3", Worksheets("Calculations").Range("B3").End(xlDown)).Rows.Count
C = ActiveWorkbook.Worksheets("Calculations").Range("C3", Worksheets("Calculations").Range("C3").End(xlDown)).Rows.Count
For X = 1 To B
Worksheets.Add().Name = Sheets("Calculations").Range("B2").Offset(X, 0).Value
Next X
Delete_Temp_Sheets
ActiveWorkbook.Worksheets("Raw Data").Sort.SortFields.Add Key:=Range( _
"F2:F376"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Raw Data").Sort
.SetRange Range("B2:V376")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'*********Working code******************
Sheets("Raw Data").Select
Cells.Find(What:="EE status", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Calculations").Select
Range("B2").Select
ActiveSheet.Paste