From the below-filtered range, I need to modify data and copy it to new sheet with Excel VBA.
The final data will look like
I'm very new to VBA and have been learning. Any help is greatly appreciated.
A very useful tool to retrieve VBA code for determined action is the macro recorder, in the ribbon, Developer -> RecordMacro, perform you action and stop recording and then you can check the code generated for the actions you recorded. Its not the cleanest code but you can find there the lines of code for the specific actions you want. Once you step into a one concrete problem with the code you tried, you can then ask for help regarding something more concrete, more than expecting that someone will code that for you.
Hope that helps
From the macro recorder, to sort a set of values, it retrieves this code:
Sub Macro2()
ActiveWorkbook.Worksheets("Hoja1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Hoja1").AutoFilter.Sort.SortFields.Add Key:=Range( _
"A1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Hoja1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
you can start from there. Try the macro recorder and record the user actions that lead tu the uotput you want. You can also try to record little steps to understand the recorded from the user action, to use that however you like.
Try out the macro recorder, its an amazing tool, and if you know what you want to do with user actions you just need to record that actions, and then fix the code a bit.
Hope that helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.