Using Find and Offset to create a dynamic range

خرید بک لینک

I am trying to build some code that will sort, search, and copy data from a data set that is ever changing. I think I need to define a variable then have the coded find the coordinates for the variable then proceed but that could be totally wrong. I have included the basic idea of what I need the code to do within the code but I do not know they syntax to make it work. Any thoughts?

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

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 207 تاريخ: جمعه 24 ارديبهشت 1395 ساعت: 5:41

صفحه بندی