LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default UserForm Delete Sheet Columns


--
Many Thanks


"GS" wrote:

Hazel explained :
Hi

I have a simple Userform that will add or delete data within 2 sheets named
Sheet1 & Sheet2
Using the sub below it will delete the Name from Col A of Sheet1 OK.
Sheet2 retains the input data in 2 columns starting at Col D. Row 1 is the
header row and is formatted as this example Row1 - Cols D & E merged and the
Name is across these 2 Cols the data starts on Row2 Cols D & E there are 20
Names & Cols formatted this way and it could be as many as 40. Is there a way
when running the sub below that it will also delete the Name and the Columns
in Sheet2 associated with the selection of Combox1 and Sheet1.

Private Sub Remove_Click()
If MsgBox("Are You Sure You Want To Delete This Name If So Click Yes",
vbYesNo) = vbNo Then
Exit Sub
Else
End If
Sheets("Sheet1").Rows(Combox1.ListIndex + 1).Delete Shift:=xlUp
End Sub

Any help much appreciated


If you put the name from Sheet1 into a string variable, you can use the
Find() function on Sheet2 to get the row to delete there.

Also, if you include .EntireRow before .Delete you won't need to
specify Shift when deleting rows.

Garry

Hi Gary

I understand the explanation for deleting the Entire Row - however I
wouldn't have a clue about Find Function and String Variable and how to
insert such a Function within the Sub - can you help with this?

Many Thanks




 
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
Delete & Merge Columns,Delete Rows with filter, etc traderindia Excel Programming 1 July 16th 09 08:17 PM
UserForm to delete unwated items off sheet? Sue Excel Programming 4 March 7th 08 02:38 PM
create a macro to delete columns and then border remaining columns Jane777 Excel Programming 1 July 18th 07 12:08 AM
userform delete sheet dok112[_16_] Excel Programming 0 June 22nd 04 04:45 PM
userform delete sheet dok112[_14_] Excel Programming 2 June 22nd 04 05:26 AM


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