Greetings,
I am trying to find out if something is possible in Excel VBA. I would like to use a string or integer to modify/represent the name of a range object. Please note that I do not have a range stored in string format.
For example, I have the following range objects already set: rng1, rng2, rng3, etc.
I am looping through rows and want to change the associated range with each iteration, using either a string or integer. Below is a sample of the code (not working) I need help with. -
Dim loImmobile As ListObject
-
Dim rowImmobile As ListRow
-
Dim shtImmobile As Worksheet
-
Dim rngPlace As Range
-
Dim intCount As Integer
-
-
Set shtImmobile = Worksheets("shtImmobile")
-
Set loImmobile = shtImmobile.ListObjects("tblImmobile")
-
intCount = 5
-
-
For Each rowImmobile In loImmobile.ListRows
-
rngPlace = RandCell(Rng(intCount))
-
'Do things with rngPlace
-
intCount = intCount + 1
-
Next rowImmobile
-
-
The problem area is in the line below. RandCell calls a function that retrieves a random cell from the given range. -
rngPlace = RandCell(Rng(intCount))
-
Thank you for your help!
2 3938 Luuk 1,047
Recognized Expert Top Contributor
With the line below you can select all kind of range's - Range(Cells(row1, col1), Cells(row2, col2)).Select
With the values:
row1=2, col1=2, row2=4, col2=5,
You will select the range "B2:E5"
Luuk 1,047
Recognized Expert Top Contributor
sorry, duplicate posting.. ;(
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Cyper Hunter |
last post by:
Hi:
Do you know how to change the url string of URL object? For example, I
have an URL object declared as:
URL myurl = new URL("http://www.cnn.com");
How to change the url string of myurl to be "http://www.yahoo.com"?
Thanks.
|
by: Thomas |
last post by:
Hi dudes,
I have a range object for text (not the one in the IE, the one for
Mozilla). Now I have a function to reduce/move the range in the text
to the LEFT, e.g.:
range.setStart(range.startContainer, startPos-1);
range.setEnd(range.endContainer, endPos-1);
range ist the range object created via
window.getSelection.getRangeAt(0).
Now I...
|
by: miki |
last post by:
Hi all,
How can I cast from a string to an object? For example, suppose I have
classes as employee, manager, supervisor, director,...I have a user
interface that takes a person name, then performs query database and
returns a string which tells that person is either employee,
manager,...If it's student, a student object will be return. I...
|
by: GlennDoten |
last post by:
I just happened to be looking through the implementation of the
System.Version class in the SSCLI and one of the constructors starts
like this:
public Version(String version) {
if ((Object) version == null)
throw new ArgumentNullException("version");
Does anyone have any ideas why the string parameter is being cast to an
object prior to...
|
by: Howard Weiss |
last post by:
I am writing an application which automates Excel from Managed Visual C++.
I have imported the Microsoft Excel Objects COM object per KB 303871 and KB
303872. If I do this in C# or VB, the ObjectBrowser provides interfaces for
the Range Object, Pivot Tables, etc. I see the following hierarchy in the
Object Browser
Interop.Excel
Excel
| |
by: Jeffrey Bradshaw |
last post by:
Is there any way to make a copy of a word.range object? I have a range in a
document and I need to monkey around with it but I don't want to change the
original in the document. I've tried Duplicate() and assigning it to a new
variable. But if I change the stuff in the new variable, it changes the
original also.
So what I need is a new copy...
|
by: Orit |
last post by:
Hello .
Please find below my questions - I hope some of the ASP.NET experts of
this forum will answer to those beginner's questions :
My Web site should be able to work with either SQL Server or Access
database as following :
It will connect first to the Master database (SQL or Access,
connection String of this database should be read...
|
by: vunet |
last post by:
I used DOMParser to convert a response string to XML object:
DOMParser.parseFromString()
In browsers where DOMParser is not supported (Safari 1-2 for my case)
I cannot use DOMParser. What method is normally used to convert a
string to XML object. For Firefox I use E4X. For IE I use
ActiveXObject loadXML() method.
Thanks.
|
by: chethan g |
last post by:
Hi,
I need to select the whole Excel sheet in Range object and then need to apply "alignment" and "autofit column width".
As I have many merged cells, when I attempt to autofit the column width I face an error.
|
by: kirubagari |
last post by:
Hi expert,
Need some advise on assigning string into an object.
slot = lvwLotsToSkip.ListItems.Item(i).text
Dim olot As Object
olot = slot
rc.Init olot, Nothing, Nothing, "SkipMultipleLot"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |