473,326 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Excel: Populating a range with a formula

Hey all,

Here's the culprit:

Expand|Select|Wrap|Line Numbers
  1. Sub PopulateRange(Cell_Range As Range)
  2.  
  3. Dim v
  4. Dim i As Long
  5. Dim j As Long
  6. Application.ScreenUpdating = False
  7. ReDim v(1 To Cell_Range.Rows.Count, 1 To Cell_Range.Columns.Count)
  8. For i = 1 To Cell_Range.Rows.Count
  9. For j = 1 To Cell_Range.Columns.Count
  10.  
  11. 'only takes last 8 chars of data cell
  12. v(i, j) = "=RIGHT(G" & i & ", 8)"
  13. 'fills the cells in Z column a calculation that calculates based off the information in the cell that is filled by the above line
  14. v(i + 1, j) = "=ExtractNumber(Z" & i & ", , True)"
  15. Next j
  16. Next i
  17. Cell_Range.Value = v
  18. Application.ScreenUpdating = True
  19. End Sub
What should happen:
I pass in the range and it fills that range with two calculation I have (already made it and verified it words "ExtractNumber") which calculates some stuff to the left of it brilliantly and everyone at my office loves me.

What happens:
Doesn't do anything all all... but when error testing it's popping up my MsgBox with exactly what I want to have placed in the range but doesn't populate it and everyone at my office hates me.
Nov 17 '09 #1
1 1495
Guido Geurs
767 Expert 512MB
dear,

The v is an array !
If you want the values of that array, you have to define them

Cell_Range.Value = v (??,??)

I have tried to sumulate you problem : see ataachment



br,
Attached Files
File Type: zip EXCEL cut text from range_v2.zip (11.0 KB, 61 views)
Nov 21 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Maik | last post by:
Hello, I've got a problem with access to special ranges. I renamed some cells (for example "C4" in "CUSTOM.GENERAL.VPRIM"). This is necessary, because I have to read out only these cells in...
2
by: Ryan Riddell | last post by:
I wrote an application to pull data from certain ranges of an Excel workbook. The application works great for the first 2 of 4 sections I created. I created the third section of code and the...
3
by: afirst | last post by:
Hello. I have just started using macros in Excel- I recorded a simple formula-now I need the macro to work on a number of spreadsheets, regardless of the number of cases the spreadsheet contains ...
1
by: MAdcock | last post by:
I have been having major problems trying to write a piece of code to basically tally (add) values in a table (column B) that have the same product name (column A). The problem is that the table is...
3
by: Esmael | last post by:
Hi to all... Goodmorning am working on a Project on VB6. THis is an excel automation... the VB6 Program reads from the Excel File and transfer the search data if found to another excel file......
1
by: =?Utf-8?B?Q2hyaXMgd2FsbGVy?= | last post by:
I have a column of dates (A) on an Excel Spreadsheet. I would like a formula that gives me the Wednesday following. If the date is a Wednesday I would like it to show me the Wednesday of the...
1
by: barnzee | last post by:
Hi all, newbie here, but having a go I am trying to build a stock watchlist in excel 2007 with a dynamic link to a DDE server (paid for from a broker).There is no add-in or plug-in, I just CTL ALT...
1
by: ATSRND | last post by:
I would like to write the code to select a range of worksheets in MS Excel 07, starting with the Activesheet and ending with the last sheet.
0
by: attraankit | last post by:
i am working in asp. my concern is how to read an excel spreadsheet using asp, especially when the range in the excel spreadsheet is unknown. i am designing a user form where the use has to browse...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.