#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Using Offset in VBA

I am quite new to VBA.

I have a range O5:O21 called "thisarea" which is not always full.

Using

Sub test()

Dim rascal As Range

For Each rascal In Range("thisarea")
With Sheets("front page")
.Range("a2").Value = rascal.Value
.Calculate
MsgBox rascal.Value



End With
Next rascal

End Sub

I would like this to return only 'full cells' (the cells will always
have a formular in them)

I know offset will work but I am having a bad day and can't work it
out


Help please

Matthew

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Using Offset in VBA

I'm not sure how offset fits in here, but if you wanted to look at the cells in
ThisArea that don't evaluate to "" (looking empty):

Sub test()
Dim rascal As Range

For Each rascal In Range("thisarea").cells
With Sheets("front page")
if rascal.value = "" then
'skip it
else
.Range("a2").Value = rascal.Value
.Calculate
MsgBox rascal.Value
end if
End With
Next rascal
End Sub

If you wanted to avoid the cells that are really empty--no values, no formulas:

Sub test()
Dim rascal As Range

For Each rascal In Range("thisarea").cells
With Sheets("front page")
if isempty(rascal.value) then
'skip it
else
.Range("a2").Value = rascal.Value
.Calculate
MsgBox rascal.Value
end if
End With
Next rascal
End Sub

Matthew wrote:

I am quite new to VBA.

I have a range O5:O21 called "thisarea" which is not always full.

Using

Sub test()

Dim rascal As Range

For Each rascal In Range("thisarea")
With Sheets("front page")
.Range("a2").Value = rascal.Value
.Calculate
MsgBox rascal.Value

End With
Next rascal

End Sub

I would like this to return only 'full cells' (the cells will always
have a formular in them)

I know offset will work but I am having a bad day and can't work it
out

Help please

Matthew


--

Dave Peterson
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
Offset Esrei Excel Discussion (Misc queries) 1 February 16th 07 11:42 AM
Offset Help Hunter Excel Worksheet Functions 5 January 26th 07 02:21 PM
OFFSET HELP Scott@CW Excel Worksheet Functions 1 December 21st 06 04:27 AM
Offset Brian Excel Worksheet Functions 6 April 7th 06 12:33 PM
SUM(OFFSET)? Mike Fogleman Excel Worksheet Functions 10 December 29th 04 08:39 PM


All times are GMT +1. The time now is 08:35 AM.

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"