Solved

Populate column excel using vba

Posted on 2013-05-21
8
827 Views
Last Modified: 2013-05-22
How using VBA  can I populate a column "B" sheet1 with text "AB" to end of row?
0
Comment
Question by:leezac
  • 5
  • 2
8 Comments
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39185865
Hi,

Do you mean you wish for columns [ B ],[C],[D],[E]... to [IV] (Excel 2003) or [XFD] (Excel 2007 onwards) to contain the text "AB"?

If so, this code will apply to row 3:

Range(Cells(3&, "B"), Cells(3&, Cells.Columns.Count)) = "AB"

Open in new window


If that is not what you meant, please clarify.  Thank you.

BFN,

fp.
0
 
LVL 3

Assisted Solution

by:Shane Kahkola
Shane Kahkola earned 100 total points
ID: 39185866
If you are talking about filling all available cells from column A to the last available column with the text "AB"; here is one way to do it.
    
    Dim r As Range
    Set r = Rows("1:1")
    
    Sheet1.Cells(1, 1) = "AB"
    r.FillRight

Open in new window

If you only want to fill from column A to column AB with some text; here is one way to do that:
    Sheet1.Cells(1, 1) = "Enter Text Here"
    Sheet1.Range("A:AB").FillRight

Open in new window

If you want to request input from the user for the text:
    Sheet1.Cells(1, 1) = InputBox("Enter Text", "Insert")
    Sheet1.Range("A:AB").FillRight

Open in new window

0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39185869
I'm glad it wasn't just me that had to ask about the question! :)
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:leezac
ID: 39185912
I just actually want to populate sheet19 only column W down to end of last used row in column A...

Does that help?
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39185994
How using VBA  can I populate a column "B" sheet1 with text "AB" to end of row?
I just actually want to populate sheet19 only column W down to end of last used row in column A...

Does that help?

It depends... if we ask again will the question be something different?
0
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 400 total points
ID: 39186001
Assuming [Sheet19] is active (selected):

Range(Cells(1&, "W"), Cells(Cells(Cells.Rows.Count, 1).End(xlUp).Row, "W")) = "AB"

Open in new window


BFN,

fp.
0
 

Author Comment

by:leezac
ID: 39186004
No, will not change.. ...
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39186021
In that case, please use the suggestion posted in comment ID: 39186001.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question