Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Object required when formatting

Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset(1,
2).Value
Format(Sheets("WOW Reps").Range("C" & Counter), "0.00%") =
Cell1.Offset(0, 3).Value
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset(0,
2).Value

Why do I get the error object required on the second line
of code? I am trying to format it to % as 0.00%.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Object required when formatting

Hi Todd,

Try it like this:

Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset(1, 2).Value
With Sheets("WOW Reps").Range("C" & Counter)
.NumberFormat = "0.00%"
.Value = Cell1.Offset(0, 3).Value
End With
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset(0, 2).Value

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Todd Huttenstine" wrote in message
...
Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset(1,
2).Value
Format(Sheets("WOW Reps").Range("C" & Counter), "0.00%") =
Cell1.Offset(0, 3).Value
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset(0,
2).Value

Why do I get the error object required on the second line
of code? I am trying to format it to % as 0.00%.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Object required when formatting

Actually I figured it out after I posted. I changed it
to...

Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset(1,
2).Value
Sheets("WOW Reps").Range("C" & Counter) = Format
(Cell1.Offset(0, 3).Value, "0.00%")
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset(0,
2).Value

I had my format on the wrong part. What is the benfit of
using the with?


-----Original Message-----
Hi Todd,

Try it like this:

Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset(1,

2).Value
With Sheets("WOW Reps").Range("C" & Counter)
.NumberFormat = "0.00%"
.Value = Cell1.Offset(0, 3).Value
End With
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset(0,

2).Value

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Todd Huttenstine"

wrote in message
...
Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset

(1,
2).Value
Format(Sheets("WOW Reps").Range("C" &

Counter), "0.00%") =
Cell1.Offset(0, 3).Value
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset

(0,
2).Value

Why do I get the error object required on the second

line
of code? I am trying to format it to % as 0.00%.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Object required when formatting

Hi Todd,

The With...End With construct saves execution time when you are
performing multiple operations on the same base object. Your revised method
of accomplishing it with one operation will work fine, I was using two to
illustrate the two implicit operations that were occurring: applying a
number format to a cell and adding a value to a cell.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Todd Huttenstine" wrote in message
...
Actually I figured it out after I posted. I changed it
to...

Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset(1,
2).Value
Sheets("WOW Reps").Range("C" & Counter) = Format
(Cell1.Offset(0, 3).Value, "0.00%")
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset(0,
2).Value

I had my format on the wrong part. What is the benfit of
using the with?


-----Original Message-----
Hi Todd,

Try it like this:

Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset(1,

2).Value
With Sheets("WOW Reps").Range("C" & Counter)
.NumberFormat = "0.00%"
.Value = Cell1.Offset(0, 3).Value
End With
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset(0,

2).Value

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Todd Huttenstine"

wrote in message
...
Sheets("WOW Reps").Range("B" & Counter) = Cell1.Offset

(1,
2).Value
Format(Sheets("WOW Reps").Range("C" &

Counter), "0.00%") =
Cell1.Offset(0, 3).Value
Sheets("WOW Reps").Range("D" & Counter) = Cell1.Offset

(0,
2).Value

Why do I get the error object required on the second

line
of code? I am trying to format it to % as 0.00%.



.



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
R/T 424 - Object required Help Jim May Excel Discussion (Misc queries) 2 April 10th 08 03:01 PM
Object Required aftamath Excel Discussion (Misc queries) 2 March 14th 06 10:19 PM
Object required. y Excel Programming 1 April 10th 04 10:50 AM
error 424 - Object Required blb Excel Programming 0 October 1st 03 05:32 PM
Object required confusion Stuart[_5_] Excel Programming 5 July 13th 03 07:48 PM


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