Hi,
I have a quick question...
suppose I have a variable as follows:
number = 10
I wish to code the cell "A[number]", which equates to the cell "A10". How do I do that?
Hope I'm not confusing anyone!
Hi,
I have a quick question...
suppose I have a variable as follows:
number = 10
I wish to code the cell "A[number]", which equates to the cell "A10". How do I do that?
Hope I'm not confusing anyone!
Hi howwwie and welcome to the forum.
There are two ways using VBA.
and![]()
Please Login or Register to view this content.
Both should work.![]()
Please Login or Register to view this content.
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
Thanks for that! It still doesn't seem to like it...
the full problem is as shown:
I used a user-defined function in VBA called "commasep", which concatenates a group of cells separated by commas.
Next I created a macro which selects active cells in column B, and applies the function "commasep":
Sub CombineEMails()
'
' CombineEMails Macro
' Combine emails into one list, separated by commas
'
'
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
Range("F8").Select
ActiveCell.Formula = "=commasep(B2:B11)"
End Sub
===================================
See the bit where it is bolded. Instead of "B11", I wish to use B[LastRow].
I was wondering what code should I use instead of B2:B11?
Thanks!
@MarvinP
It works now that I used the "range" function: ActiveCell.Formula = commasep(Range("B2:B" & LastRow))
Thanks a lot!![]()
Last edited by howwwie; 03-19-2011 at 01:13 AM.
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks