Results 1 to 6 of 6

Thread: Loop in Array

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    10
    Rep Power
    0

    Loop in Array

    Team,

    I am finally moving from manipulating data in worksheets to working with arrays.

    Can someone suggest an alternative to to the BOLD array loop? Is there a way to change AH(a,2) thru Ah(a,8) to zeros without looping?


    Code:
    Option Explicit
    Sub ChangeRows()
    Dim AH, a As Long, aa As Long
    AH = Cells.Cells(1).CurrentRegion.Resize(, 8)
    For a = LBound(AH) To UBound(AH)
      If AH(a, 1) = "DEF" Or AH(a, 1) = "GHI" Then
    
        For aa = 2 To 8
          AH(a, aa) = 0
        Next aa
    
      End If
    Next a
    Cells.Cells(1).CurrentRegion.Resize(, 8) = AH
    End Sub

    Thanks in advance.

    Have a great day,
    Stan
    Last edited by stanleydgromjr; 07-22-2011 at 04:11 PM.

Similar Threads

  1. Delete worksheets without loop
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 5
    Last Post: 03-04-2014, 07:29 PM
  2. VBA Trick of the Week :: Slicing an Array Without Loop - Application.Index
    By Transformer in forum Tips, Tricks & Downloads (No Questions)
    Replies: 0
    Last Post: 06-12-2013, 04:40 PM
  3. Loop to two columns and Concatenate values
    By ivandgreat in forum Excel Help
    Replies: 15
    Last Post: 04-14-2013, 08:20 PM
  4. Loop through a folder and find word
    By k0st4din in forum Excel Help
    Replies: 7
    Last Post: 12-08-2012, 02:22 PM
  5. Speed up Loop VBA
    By PcMax in forum Excel Help
    Replies: 15
    Last Post: 04-09-2012, 04:20 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •