Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #331

Re: Can't select a range of data/single cell

From GS <gs@somewhere.net>
Newsgroups comp.lang.basic.visual.misc
Subject Re: Can't select a range of data/single cell
Date 2011-07-11 18:54 -0400
Organization A noiseless patient Spider
Message-ID <ivfuvq$gjh$1@dont-email.me> (permalink)
References <b964278e-bbec-469a-8b70-b43082160b26@f35g2000vbr.googlegroups.com> <ivfucb$d42$1@dont-email.me>

Show all headers | View raw


A few enhancements...
>
> ''''''''''''''''''''''''''''''''''''''''''''''''''
> ' FillHourlyKWDdata Macro                        '
> ' Loops through data in main sheet               '
> ' Copies Average rows and date from each day     '
> ' Pastes the rows and date into Hourly KWD Trends'
> ''''''''''''''''''''''''''''''''''''''''''''''''''
> Sub FillHourlyKWDdata()
>   Dim rngSource As Range, rngTarget As Range
>   Dim i As Integer
>
>   With Sheets("All Data")
>     .Visible = True: Set rngSource = .Range("A10")
>   End With
>   With Sheets("Hourly KWD Trends")
>     .Visible = True: Set rngTarget = .Range("A2")
>   End With
>
    Application.ScreenUpdating = False
>   For i = 10 To 230 Step 5
>     With rngSource
>       If .Offset(0, 1).HasFormula Then
>         rngTarget = .Offset(-4, 25)
>         'select next column over
>         With rngTarget.Offset(0, 1).Resize(, 25)
>         .Value = rngSource.Offset(0, 1).Resize(, 25).Value
>         End With 'rngTarget.Offset(0, 1).Resize(, 25)
>         Set rngSource = rngSource.Offset(5, 0)
>         Set rngTarget = rngTarget.Offset(1, 0)
>       Else
>         Set rngSource = rngSource.Offset(1, 0)
>       End If 'rngSource.Offset(0, 1).HasFormula
>     End With 'rngSource
>   Next 'i
    With Application
      .ScreenUpdating = False
      .Goto Sheets("All Data").Range("A1")
    End With 'Application
    'Cleanup
    Set rngSource = Nothing: Set rngTarget = Nothing
> End Sub

-- 
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Can't select a range of data/single cell ACE <aenten1@gmail.com> - 2011-07-11 12:34 -0700
  Re: Can't select a range of data/single cell GS <gs@somewhere.net> - 2011-07-11 18:44 -0400
    Re: Can't select a range of data/single cell GS <gs@somewhere.net> - 2011-07-11 18:54 -0400
      Re: Can't select a range of data/single cell GS <gs@somewhere.net> - 2011-07-11 18:56 -0400
        Re: Can't select a range of data/single cell ACE <aenten1@gmail.com> - 2011-07-12 08:45 -0700
          Re: Can't select a range of data/single cell GS <gs@somewhere.net> - 2011-07-12 11:50 -0400

csiph-web