excel - Looping through Macro to sort through column of data
问题描述
I am trying to loop through a column of data and move all data below "south" but above "north"/"east"/"West". The data is random and tied to each title so I can't sort alphabetically.
Without the loop; I am able to sort the first cell under "south" but when I utilise a loop nothing works. Please can someone advise or point me in the right direction?
Dim rng As Range
Dim i As Integer
For i = 1 To rng.Rows.Count
Dim rngFound As Range
Dim rngFoundTrue As Range
Set rngFound = Cells.Find(What:="SOUTH", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
Set rngFoundTrue = rngFound.Offset(1, 0)
rngFoundTrue.Cut Destination:=rngFoundTrue.Offset(0, 1)
Set rngFound = Nothing
Do Until rngFoundTrue.Value = "NORTH" Or "WEST" Or "EAST"
Next
End Sub
Thank you!
解决方案
推荐阅读
- c - Lexer 将标识符的一部分识别为关键字
- apache - 如何在 Centos 上使用 ansible 模块启动 httpd 服务
- amazon-web-services - 向另一台机器的 EC2 实例公开端口
- javascript - Express js 错误 404 页面用静态文件拦截
- php - Laravel,阿帕奇
- vba - 如何遍历子文件夹?
- vba - 检查数组中的数据是否存在于工作表中
- ios - 存折-带有刻度的 storeCard 设计
- python - `CDLL()` 如何找到要加载的文件,只有文件基名?
- sql - sql server 等效于 xmlelement 格式