Home > Software engineering >  Custom sequence
Custom sequence

Time:03-03

Always say worksheet function range error, where is wrong?
HTML code is as follows, sheet3 custom sequence, there is a sequence of, the rest of the workbook is no sorting name, last name and name, unsorted
Help me to check where is wrong! Help!

Option Explicit

Sub not ()


Dim sin As Worksheet, RNG As the Range, the I, As Long As myorder Range

The Set myorder=Worksheets (" sheet3 "). The Range (" b3: b18 ")



Application. AddCustomList (myorder)


For Each sin Worksheets In

If sin. The Name & lt;> "Sheet3" Then

I=2

The Do While sin. Cells (I, 2). The Value & lt;> "
"Sin. Cells (I, 1). The Value=https://bbs.csdn.net/topics/Left (sin) Cells (I, 2), 1)
I=I + 1
Loop


Set RNG=sin. Range (Cells (1, 1), Cells (1, 1). The End (xlDown) End (xlToRight))

RNG. Sort key1:=Range (A: "A"), ordercustom:=Application. CustomListCount + 1

Range (A: "A"). The Clear

End the If
Next


Application. DeleteCustomList (Application. CustomListCount + 1)



End Sub

CodePudding user response:

Zha think you this operation is to put the name in the name of the column in a new column, then vlookup to find the corresponding serial number from the sheet3, finally with the serial number column sorting,
Operation again to record a macro, and then make a little change,

CodePudding user response:

Set RNG=sin. Range (Cells (1, 1), Cells (1, 1). The End (xlDown) End (xlToRight))
This line:
Set RNG=sin. Range (sin) Cells (1, 1), sin. The Cells (1, 1). The End (xlDown) End (xlToRight))
Have a try?

CodePudding user response:

Has been solved, thank you, didn't pay attention to details
  •  Tags:  
  • VBA
  • Related