Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default ActiveCell.Offset w/ VBA

If IsEmpty(ActiveCell.Offset(0, -1)) Then
ActiveCell.Offset(0, -1).Value =
Application.WorksheetFunction.Text(11900, "000000")
End If

You had misused Range. Range takes something like:
Range("A5")
Range("G3:G12")
etc. (many others)
Range(ActiveCell.Offset(0,-1).Value) only would mean something if
Activecell.Offset(0,1).Value were something like A5 or G3:G12, etc.
Also, you have Active.Cell rather than ActiveCell.
Also, instead of Application.WorksheetFunction.Text(11900, "000000"), use
"011900", but then you'd have to format the cell anyway!
Bob Umlas
Excel MVP


"green67beanie" wrote in message
...
I am searching down a column for a particular value and if found, want to
check the cell to the immediate left for being empty. If it is, I want to
insert a text value derived from a function, and then continue with a find
next. I am getting an error, Run time error "424" Object required, from

the
following true condition statement:

If IsEmpty(ActiveCell.Offset(0, -1)) Then
Range(Active.Cell.Offset(0, -1)).Value =
Application.WorksheetFunction.Text(11900, "000000")
End If

I initially tried the following line there, but got the same error:

Active.Cell.Offset(0, -1).FormulaR1C1 =
Application.WorksheetFunction.Text(11900, "000000")

Any suggestions?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default ActiveCell.Offset w/ VBA

Thanks, Bob for the speedy response. My initial approach (without using the
Range()), after correcting the Active.Cell to ActiveCell error you pointed
out worked fine.

"Bob Umlas" wrote:

If IsEmpty(ActiveCell.Offset(0, -1)) Then
ActiveCell.Offset(0, -1).Value =
Application.WorksheetFunction.Text(11900, "000000")
End If

You had misused Range. Range takes something like:
Range("A5")
Range("G3:G12")
etc. (many others)
Range(ActiveCell.Offset(0,-1).Value) only would mean something if
Activecell.Offset(0,1).Value were something like A5 or G3:G12, etc.
Also, you have Active.Cell rather than ActiveCell.
Also, instead of Application.WorksheetFunction.Text(11900, "000000"), use
"011900", but then you'd have to format the cell anyway!
Bob Umlas
Excel MVP


"green67beanie" wrote in message
...
I am searching down a column for a particular value and if found, want to
check the cell to the immediate left for being empty. If it is, I want to
insert a text value derived from a function, and then continue with a find
next. I am getting an error, Run time error "424" Object required, from

the
following true condition statement:

If IsEmpty(ActiveCell.Offset(0, -1)) Then
Range(Active.Cell.Offset(0, -1)).Value =
Application.WorksheetFunction.Text(11900, "000000")
End If

I initially tried the following line there, but got the same error:

Active.Cell.Offset(0, -1).FormulaR1C1 =
Application.WorksheetFunction.Text(11900, "000000")

Any suggestions?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ActiveCell.Offset w/ VBA

It works fine, it is just slower.
ActiveCell.Offset(0, -1).Value = _
format(11900, "000000")

or
ActiveCell.Offset(0, -1).Value = _
"011900"

Would work the same as your code but would be faster. (although the
difference may not be noticeable).


--
Regards,
Tom Ogilvy

"green67beanie" wrote in message
...
Thanks, Bob for the speedy response. My initial approach (without using

the
Range()), after correcting the Active.Cell to ActiveCell error you pointed
out worked fine.

"Bob Umlas" wrote:

If IsEmpty(ActiveCell.Offset(0, -1)) Then
ActiveCell.Offset(0, -1).Value =
Application.WorksheetFunction.Text(11900, "000000")
End If

You had misused Range. Range takes something like:
Range("A5")
Range("G3:G12")
etc. (many others)
Range(ActiveCell.Offset(0,-1).Value) only would mean something if
Activecell.Offset(0,1).Value were something like A5 or G3:G12, etc.
Also, you have Active.Cell rather than ActiveCell.
Also, instead of Application.WorksheetFunction.Text(11900, "000000"),

use
"011900", but then you'd have to format the cell anyway!
Bob Umlas
Excel MVP


"green67beanie" wrote in

message
...
I am searching down a column for a particular value and if found, want

to
check the cell to the immediate left for being empty. If it is, I want

to
insert a text value derived from a function, and then continue with a

find
next. I am getting an error, Run time error "424" Object required,

from
the
following true condition statement:

If IsEmpty(ActiveCell.Offset(0, -1)) Then
Range(Active.Cell.Offset(0, -1)).Value =
Application.WorksheetFunction.Text(11900, "000000")
End If

I initially tried the following line there, but got the same error:

Active.Cell.Offset(0, -1).FormulaR1C1 =
Application.WorksheetFunction.Text(11900, "000000")

Any suggestions?






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
ActiveCell.Offset Question ash3154 New Users to Excel 5 September 12th 09 01:46 PM
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Sum Activecell Offset Problem George Andrews Excel Worksheet Functions 3 May 22nd 05 12:12 AM
activecell offset rvik Excel Programming 1 December 24th 03 07:47 AM


All times are GMT +1. The time now is 01:21 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"