How to get the Next alphabet...in vb6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sivadhanekula
    New Member
    • Nov 2008
    • 58

    How to get the Next alphabet...in vb6

    Hi all

    I am working on excel, Macros with vb6....When I was writing the for loop I got stuck with getting the next alphabet...Like I need to extract the data from a database and I need to split that data in to equal parts and each part should go to diff column in the excel sheet like A, B, C, D.....Z
    if you look at the code

    For n = 0 To 20
    Avg = (ls - ks) / qs
    n = n + 1
    Range("A" & (ks + ((n - 1) * Avg) + 1) & ": A" & (ks + (n * Avg))).Select
    Selection.Copy
    Sheets("Sheet3" ).Select
    Range("A1").Sel ect
    ActiveSheet.Pas te
    Sheets("Subtest ").Select
    Next
    in the code if you look at the Bold letters...and when the loop is running I need the Next alphabet in the place of A i.e. B,C,D,E...Z like that it should go...

    Can you please help me in this case...fast reply would be of gr8 help...

    thnq

    Regards
  • ubentook
    New Member
    • Dec 2007
    • 58

    #2
    Replace...
    Range("A1").Sel ect

    With...
    Cells(Rows.Coun t, 1).End (xlup).Offset(1 , 0).Select

    Comment

    • sivadhanekula
      New Member
      • Nov 2008
      • 58

      #3
      thnq for the reply...

      when I replace the line with the mentioned line the output stays only in one column...i.e. in column A...but I want the partition in different columns like A, B, C, D....Z
      For n = 1 To 20
      n = n + 1
      Range("A" & (ks + ((n - 1) * Avg) + 1) & ": A" & (ks + (n * Avg))).Select
      Selection.Copy
      Sheets("Sheet3" ).Select
      Cells(Rows.Coun t, 1).End(xlUp).Of fset(1, 0).Select
      ActiveSheet.Pas te
      Sheets("Subtest ").Select
      Next

      Comment

      • ubentook
        New Member
        • Dec 2007
        • 58

        #4
        It works for me in Excel 2002...
        If four adjoining cells are copied then the paste occurs in four adjoining cells.

        Comment

        Working...