Solved

Populate column excel using vba

Posted on 2013-05-21
8
793 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now