화요일, 10 월 2022
  1 답글
  5.5K 방문
0
투표
취소
I'm using the following code listed below. I works fine, but It wipes out the formula in one of my cells. How do I modify this code to skip one cell in my sheet?

하위 MoveRowBasedOnCellValue()
'에 의해 업데이트됨 Extendoffice 2017/11/10
범위로 Dim xRg
xCell을 범위로 흐리게 처리
오랫동안 어둡게
딤 J As Long
딤케이 애즈롱
i = Worksheets("Data").UsedRange.Rows.count
J = Worksheets("Completed").UsedRange.Rows.count
J = 1이면
If Application.WorksheetFunction.CountA(Worksheets("Completed").UsedRange) = 0 Then J = 0
END IF
Set xRg = Worksheets("Data").Range("A1:A" & i)
오류에 대한 다음 재개
Application.ScreenUpdating = False
For K = 1 To xRg.count
If CStr(xRg(K).Value) = "Completed" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Completed").Range("A" & J + 1)

xRg(K).EntireRow.ClearContents


J = J + 1
END IF
다음 보기
Application.ScreenUpdating = True
열("A:A").선택
ActiveWorkbook.Worksheets("Data").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Data").Sort.SortFields.Add2 Key:=Range("A3:A16") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Data").Sort
.SetRange Range("A2:Q16")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.대다
Application.Goto Reference:=Worksheets("Data").Range("A3")
0
투표
취소
안녕,

Did you accidentally copied only part of the code that was actually working? Since the one you provided is not complete.

Anyway, to skip one cell in your sheet, you can add a string as shown in the picture below. Remember to replace the cell $A$2 with the actual cell to skip in your sheet.
skip cell.png

추가 질문이 있으시면 언제든지 저에게 질문해 주십시오.

아만다
첨부 파일 (1)
  • 페이지 :
  • 1
이 게시물에 대한 답변이 없습니다.