Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Move up text

I have the following code for deleting an entry on a worksheet:

Dim rng As Range, res As Variant, rng1 As Range
Set rng = Worksheets("Blend Sheet").Range("b8:b23")


res = Application.Match(CStr(ComboBox1.Text), rng, 0)
If Not IsError(res) Then
Set rng1 = rng(res)
rng1.Offset(0, 5).Value = ClearContents
rng1.Offset(0, 0).Value = ClearContents


What do I need to add to the code to move up the entries in the cells below
the entry I am deleting and within the range ?

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Move up text

Does your code work?
ClearContents is a method, but it looks like you've made a variable called
ClearContents.

The usual syntax is rng1.Offset(0, 5).ClearContents

To move the values from the row after, eg.
rng1.Offset(0, 5).Value = rng1.Offset(1, 5).Value


PS. What are you Blending?


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gregork" wrote in message
...
I have the following code for deleting an entry on a worksheet:

Dim rng As Range, res As Variant, rng1 As Range
Set rng = Worksheets("Blend Sheet").Range("b8:b23")


res = Application.Match(CStr(ComboBox1.Text), rng, 0)
If Not IsError(res) Then
Set rng1 = rng(res)
rng1.Offset(0, 5).Value = ClearContents
rng1.Offset(0, 0).Value = ClearContents


What do I need to add to the code to move up the entries in the cells
below
the entry I am deleting and within the range ?

Greg




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Move up text

Greg,

I think this is what you mean

Dim rng As Range, res As Variant, rng1 As Range
Set rng = Worksheets("Blend Sheet").Range("b8:b23")


res = Application.Match(CStr(ComboBox1.Text), rng, 0)
If Not IsError(res) Then
Set rng1 = rng(res)
rng1.Offset(0, 5).Delete Shift:=xlUp
rng1.Offset(0, 0).Delete Shift:=xlUp


--

HTH

RP
(remove nothere from the email address if mailing direct)


"gregork" wrote in message
...
I have the following code for deleting an entry on a worksheet:

Dim rng As Range, res As Variant, rng1 As Range
Set rng = Worksheets("Blend Sheet").Range("b8:b23")


res = Application.Match(CStr(ComboBox1.Text), rng, 0)
If Not IsError(res) Then
Set rng1 = rng(res)
rng1.Offset(0, 5).Value = ClearContents
rng1.Offset(0, 0).Value = ClearContents


What do I need to add to the code to move up the entries in the cells

below
the entry I am deleting and within the range ?

Greg




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
Text - Remove text Item No.99 (First 2 Chars) and move to end dplunkett Excel Discussion (Misc queries) 5 June 16th 09 04:26 PM
Using VBA to move from one text box to another BLevie Excel Discussion (Misc queries) 1 January 28th 09 09:53 AM
Move text pattlee Excel Discussion (Misc queries) 15 May 22nd 08 09:15 PM
Move text bgkgmg Excel Worksheet Functions 1 May 11th 08 01:28 AM


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