Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Prob with Var Data-types..

I have this macro to assign rows with data headers to the variable HderRows
- I want to return HderRows as a Row number or Cell though can't get it to
work..missing something here about Object variables or something.
- Not sure why Dim HderRows () doesn't allow empty parenthesis. Understand
this should give a variable array (though 15 is a reasonable max anyway).

Thanks

M.

Dim HderRows(15) As String
NoHderRows = 1
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(CntMon + 5, 0).Select
Loop
NoHderRows = NoHderRows - 1

'Defines HeaderRows
Range("B3").Select
For j = 1 To NoHderRows
HderRows(j) = ActiveCell.Value
ActiveCell.Offset(CntMon + 5, 0).Select
Next j
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Prob with Var Data-types..

You have 2 problems:

First is that the do while loop might possible expand past the array value.

Secondly,

you can use Dim HderRows() As String to set an unknown array size but you
must at some point use the redim to reset the array size BEFORE you start
using the array

Good Luck,

Stewart Rogers

"Mourinho" wrote:

I have this macro to assign rows with data headers to the variable HderRows
- I want to return HderRows as a Row number or Cell though can't get it to
work..missing something here about Object variables or something.
- Not sure why Dim HderRows () doesn't allow empty parenthesis. Understand
this should give a variable array (though 15 is a reasonable max anyway).

Thanks

M.

Dim HderRows(15) As String
NoHderRows = 1
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(CntMon + 5, 0).Select
Loop
NoHderRows = NoHderRows - 1

'Defines HeaderRows
Range("B3").Select
For j = 1 To NoHderRows
HderRows(j) = ActiveCell.Value
ActiveCell.Offset(CntMon + 5, 0).Select
Next j

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Prob with Var Data-types..

Thanks Stewart
ReDim...of course.

I managed to delete an important line in the code I pasted- here it is again.

I still cannot get the HderRows variable (in the 2nd part of the code) to
return a row or cell value however...I am not sure what to apply in terms of
var data-type and/or cell property (.Value?) for the loop to return a row or
cell for each HderRows variable. All my attempts are returning errors or
unwanted values.

M.

'Defines Number of Header Rows
NoHderRows = 1

Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(CntMon + 5, 0).Select
(MISSING) NoHderRows = NoHderRows + 1
Loop
NoHderRows = NoHderRows - 1

'Defines HeaderRows
Range("B3").Select
For j = 1 To NoHderRows
HderRows(j) = ActiveCell.Select
ActiveCell.Offset(CntMon + 5, 0).Select
Next j


"Datasort" wrote:

You have 2 problems:

First is that the do while loop might possible expand past the array value.

Secondly,

you can use Dim HderRows() As String to set an unknown array size but you
must at some point use the redim to reset the array size BEFORE you start
using the array

Good Luck,

Stewart Rogers

"Mourinho" wrote:

I have this macro to assign rows with data headers to the variable HderRows
- I want to return HderRows as a Row number or Cell though can't get it to
work..missing something here about Object variables or something.
- Not sure why Dim HderRows () doesn't allow empty parenthesis. Understand
this should give a variable array (though 15 is a reasonable max anyway).

Thanks

M.

Dim HderRows(15) As String
NoHderRows = 1
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(CntMon + 5, 0).Select
Loop
NoHderRows = NoHderRows - 1

'Defines HeaderRows
Range("B3").Select
For j = 1 To NoHderRows
HderRows(j) = ActiveCell.Value
ActiveCell.Offset(CntMon + 5, 0).Select
Next j

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 error "some chart types cannot be combined with other chart types. Select a different chart types" roadsidetree Charts and Charting in Excel 15 June 2nd 09 10:53 AM
Prob with ChartSource DataData Range MikeZz Charts and Charting in Excel 3 February 6th 07 06:02 PM
Data types when importing Excel data to SQLServer [email protected] Excel Discussion (Misc queries) 1 September 27th 06 12:48 PM
Urgent! Prob with Excel 2002 Template Wizard with Data Tracking ad Duncan Excel Discussion (Misc queries) 0 May 23rd 06 04:24 AM
Importing data from Access into Excel: prob w/ cutting off fields Nicole L. Excel Worksheet Functions 1 February 7th 05 10:05 PM


All times are GMT +1. The time now is 08:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"