Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Help, I posted a question on the 18th and am still needing a solut

I posted a question on the 18th "How do I move to a specified row and
insert a value?" and I was wondering if anyone knew how to solve it, my
outstanding issues a

Help!!! I can't get this code to work, what am I doing wrong??

varRef = Target.Address
varVal = Target.Value

varRow = Me.Range(varRef).Row
varCol = Me.Range(varRef).Column

---- this works above this line ----------

' Q.(1) am I supposed to declare rng as a Range ?
Dim rng As Range

' Q.(2) how do I populate the range, like this?
rng = Target

'Q.(3) Is this how I do this for row 5 (and then I'll do the same for the
other row)?
If rng.Row = 5 Then Set rng = rng.Offset(3, 0)


I've tried numerous combinations and Excel keeps generating error messages.
I wonder if it is in relation to declaring 'rng' and/or then populating it,
and/or
then finally setting it to offset as above.

Please can anyone help with this issue?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Help, I posted a question on the 18th and am still needing a solut

1. post your full code
2. indicate which line fails
3. give Excel's full error message
--
Gary''s Student - gsnu200821


"LuvMyTennis" wrote:

I posted a question on the 18th "How do I move to a specified row and
insert a value?" and I was wondering if anyone knew how to solve it, my
outstanding issues a

Help!!! I can't get this code to work, what am I doing wrong??

varRef = Target.Address
varVal = Target.Value

varRow = Me.Range(varRef).Row
varCol = Me.Range(varRef).Column

---- this works above this line ----------

' Q.(1) am I supposed to declare rng as a Range ?
Dim rng As Range

' Q.(2) how do I populate the range, like this?
rng = Target

'Q.(3) Is this how I do this for row 5 (and then I'll do the same for the
other row)?
If rng.Row = 5 Then Set rng = rng.Offset(3, 0)


I've tried numerous combinations and Excel keeps generating error messages.
I wonder if it is in relation to declaring 'rng' and/or then populating it,
and/or
then finally setting it to offset as above.

Please can anyone help with this issue?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Help, I posted a question on the 18th and am still needing a solut

Q.(1) am I supposed to declare rng as a Range ?
Dim rng As Range

The code is more efficient when all variables are declared.

' Q.(2) how do I populate the range, like this?
rng = Target

If rng is a single cell then rng = Target.Value might work if you are
running
event code with (ByVal Target as Range).

'Q.(3) Is this how I do this for row 5 (and then I'll do the same for the
other row)?
If rng.Row = 5 Then Set rng = rng.Offset(3, 0)

Is this how you do what for row 5?
The code is OK but I don't understand the question.

I've tried numerous combinations and Excel keeps generating error messages.

Do you click the Help button when the error messages appear?
That generally explains what is causing the error.

I wonder if it is in relation to declaring 'rng' and/or then populating it,
and/or then finally setting it to offset as above.

If you would post the actual code that you are using and give a concise
explanation of what you are trying to accomplish, I am pretty sure that some
of the folks who monitor this site could help.

"LuvMyTennis" wrote:

I posted a question on the 18th "How do I move to a specified row and
insert a value?" and I was wondering if anyone knew how to solve it, my
outstanding issues a

Help!!! I can't get this code to work, what am I doing wrong??

varRef = Target.Address
varVal = Target.Value

varRow = Me.Range(varRef).Row
varCol = Me.Range(varRef).Column

---- this works above this line ----------

' Q.(1) am I supposed to declare rng as a Range ?
Dim rng As Range

' Q.(2) how do I populate the range, like this?
rng = Target

'Q.(3) Is this how I do this for row 5 (and then I'll do the same for the
other row)?
If rng.Row = 5 Then Set rng = rng.Offset(3, 0)


I've tried numerous combinations and Excel keeps generating error messages.
I wonder if it is in relation to declaring 'rng' and/or then populating it,
and/or
then finally setting it to offset as above.

Please can anyone help with this issue?

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
Question not posted? Simon New Users to Excel 4 May 5th 10 05:50 PM
Please can someone look at question i posted yesterday jimE Excel Worksheet Functions 2 October 23rd 07 10:27 PM
Solver working intermittingly...tried some previously posted solut robs3131 Excel Programming 4 October 4th 07 10:22 AM
How do I get back to a question I've posted? Jim Excel Discussion (Misc queries) 2 June 6th 07 04:24 PM
Userform Question Posted Again Tom Ogilvy Excel Programming 0 May 18th 04 04:59 PM


All times are GMT +1. The time now is 12:25 AM.

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

About Us

"It's about Microsoft Excel"