By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

How to get the Next alphabet...in vb6

P: 58
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").Select
ActiveSheet.Paste
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
Jul 30 '09 #1

✓ answered by ubentook

Replace...
Range("A1").Select

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

Share this Question
Share on Google+
3 Replies


P: 58
Replace...
Range("A1").Select

With...
Cells(Rows.Count, 1).End (xlup).Offset(1, 0).Select
Aug 1 '09 #2

P: 58
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.Count, 1).End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Sheets("Subtest").Select
Next
Aug 4 '09 #3

P: 58
It works for me in Excel 2002...
If four adjoining cells are copied then the paste occurs in four adjoining cells.
Aug 4 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.