Solved

select a range that may include blank cells

Posted on 2014-12-08
3
97 Views
Last Modified: 2014-12-09
can an expert help me out here.

I need to select a range that includes blank cells.

i.e. The range I need to select is from A to P and could be A1 to P10 or A1 to P50  etc

within that range there are sometimes blank columns i.e. column F, column I, column K , Column L but sometimes these columns will have data.

Can you provide VBA that will select this sort of range please.
0
Comment
Question by:Jagwarman
3 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
Comment Utility
Do you mean:

range(cells(1,1),cells(50,16)).Select

Open in new window

?
0
 
LVL 33

Expert Comment

by:Norie
Comment Utility
This will select everything from column A to P from row 1 down to the last row in column P.
Range("A1", Range("P" & Rows.Count).End(xlUp)).Select

Open in new window

0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
Hi,

If the complete col is Col A

then pls try

Range(Range("A1"), Cells(Range("A" & Cells.Rows.Count).End(xlUp).Row, "P")).Select

Regards
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

762 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

11 Experts available now in Live!

Get 1:1 Help Now