Solved

Populate column excel using vba

Posted on 2013-05-21
8
857 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

821 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