i have the code which is working in a spacific range , i need move value ranfance and proide output acordingly

  Kiến thức lập trình

below is the code i need to work in all below range till end the value available

i have the code which is working in a specific range , i need move value ranfance and proide output accordingly.

Sub CTC_Code()
Sheets("CTC_Calculator_A1").Activate
  'ActiveSheet.Unprotect Password:="123321"
  
  If Range("C2").Value >= 50000 Then `i need to move the range in down sell`
     Range("H2").Formula = "=ROUND(G2*50%,0)" `i need to move the range in down sell`

    Range("V2").Select
    Selection.Copy
    Range("K2").Select

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If


    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If


    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If
 
 Else: End If
  
  '--------------------------------------------------------------------
   If Range("C2").Value >= 27000 And Range("C2").Value <= 49999 Then
     Range("H2").Formula = "=ROUND(G2*50%,0)"

    Range("V2").Select
    Selection.Copy
    Range("K2").Select

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If


    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If


    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If
 
 Else: End If
 
 If Range("C2").Value <= 26999 Then
 
 Range("H2").Formula = "=ROUND(0,0)"
 Range("K2").Formula = "=ROUND(0,0)"
 
  
    Range("V2").Select
    Selection.Copy
    Range("H2").Select

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If

    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If


    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If


    If Range("Z2").Value <> 1 Then
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, skipblanks:=False, Transpose:=False
    Else: End If
 Else: End If
 
    Application.CutCopyMode = False
    Range("C2").Select
    'ActiveSheet.Protect Password:="123321"
End Sub

3

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT