LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Eliminate blank row at top of Text Box entries

This code works just fine, (notice Claus in the sub name, thank you).
It does produce a blank row at the top of any entries in the text box.
To me, that is just fine, in fact I prefer that over no top margin.

However, the end user wants it gone.
I've tried some variations of this line along with a parse of the text box properties and cannot find a way to just eliminate the blank row. I was able to eliminate it with one revamp of the code line but it then produced double entries of each entry.

I need to keep the current entries already in the box and add to them with additional entries, which this line just below here does. But with an empty box the first entry needs to go to the very top of the box.

Regards,
Howard


ActiveSheet.TextBox1.Text = ActiveSheet.TextBox1.Text _
& vbCr & MyStringVariable


Option Explicit

Sub TheT_Box_Claus()
Dim MyStringVariable As String '
Dim IndexCol As Range '
Dim IndexLibry As Range '
Dim c As Range '
Dim rngC As Range '
Dim strIn As String '
Dim varOut As Variant '
Dim myCount As Integer '

Set IndexCol = Sheets("Input").Range("A2:A100")
Set IndexLibry = Sheets("Sort").Range("A3:A25")

strIn = Application.InputBox("Enter one number or " _
& "more numbers comma delimited", Type:=3)
myCount = Len(strIn) - _
Len(WorksheetFunction.Substitute(strIn, ",", ""))
IndexLibry.ClearContents

If myCount = 0 Then
[A3] = strIn
Else
varOut = Split(strIn, ",")
Cells(3, 1).Resize(myCount + 1, 1) = _
WorksheetFunction.Transpose(varOut)
End If

For Each c In IndexLibry
Set rngC = IndexCol.Find(c, LookIn:=xlValues, lookat:=xlWhole)
If Not rngC Is Nothing And rngC < "" Then

'*****/// add additional columns here ///******
' Lets just call this an add-column unit: & ", " & rngC.Offset(0, 10)
' the "&" appends the code to existing code.
' the ", " adds a comma between the column entries.
' then you need another "&"
' and this defines the column you want to add: rngC.Offset(0, 10)
' so the add-column shown above would add column K, _
' 10 columns to the right of the IndexCol
' the one with the header "G(#F,#R)"
' and you would insert it in the code to suit the order of _
' apperance you want in the text box

MyStringVariable = "(" & rngC & ") " & rngC.Offset(0, 4) _
& ", " & rngC.Offset(0, 1) & ", " & rngC.Offset(0, 2) _
& ", " & rngC.Offset(0, 14) & ", " & rngC.Offset(0, 15) _
& ", " & rngC.Offset(0, 18)
ActiveSheet.TextBox1.Text = ActiveSheet.TextBox1.Text _
& vbCr & MyStringVariable
End If
Next

End Sub
 
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
Eliminate double entries in datalist in bulk [email protected] Excel Discussion (Misc queries) 0 October 17th 07 03:15 PM
Eliminate Overlapping Entries Mark@Marc Excel Worksheet Functions 4 February 20th 06 10:51 PM
In 2 Excel worksheets, I am trying to eliminate duplicate entries jgentile Excel Worksheet Functions 2 November 6th 05 01:05 AM
How to eliminate duplicate entries Tara Keane Excel Discussion (Misc queries) 4 March 2nd 05 05:33 PM
eliminate duplicate entries in column automatically Frank Kabel Excel Programming 0 September 10th 04 04:36 PM


All times are GMT +1. The time now is 12:32 PM.

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"