ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning an array to range object? (https://www.excelbanter.com/excel-programming/383373-assigning-array-range-object.html)

Smitch

Assigning an array to range object?
 
Hi,

This seems like a silly question but I cant seem to find the answer€¦

In VBA I can do this
Dim wks As Worksheet
Dim rng As Range

Set wks = ThisWorkbook.ActiveSheet
Set rng = wks.Range("A1").Resize(1, 5)
rng = Array("One", "Two", "Three", "Four", "Five")

How do I do the same in VB.NET (2005)?

Thank you,

~Smitch


merjet

Assigning an array to range object?
 
http://www.vb-helper.com/howto_net_declare_arrays.html

Hth,
Merjet



Smitch

Assigning an array to range object?
 
Thank you for the response€¦ I should rephrase my question:

When in VB.NET using the Interop libraries how do you get the
Range = Array assignment to work.

I always get an cast exception. I have tried straight array as well as
object array.

Thank you,
~Smitch


"merjet" wrote:

http://www.vb-helper.com/howto_net_declare_arrays.html

Hth,
Merjet





All times are GMT +1. The time now is 12:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com