Question about Compilers & Programming Tools

1 Answer

Excel I have list two columns in excel naming header as S.No. and S.Name I would like to create drop down box for the S.No. and S.Name. If I select an item from the drop down box of S.No the repective S.Name should appear. If I select a name from the drop down box of S.Name the respective S.No. should appear in the S.No. cell

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 6 Answers

Hey dude,

Select both the columns and click on Auto-filter option. This will give you a drop-down list box to select data of your choice.

Posted on Sep 22, 2008

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

I want to prepare a letter head on plain paper, how I put my company logo & name, as well address on it, What I mean is how to put header & footer on paper?


Letter head on Plain Paper



Step1: Open a Microsoft Word Document File








Usually word creates a new document when the program is opened.



Step 2: Inserting Header and Footer in Word Document
Click on view and then Header and Footer.




Step 3: In a Microsoft Word document, choose Insert > Picture > From File… After selecting file, it will give you a browse file option, where you have to specify the location of the logo file you have created with desired resolution and size.




Step 5: Control-click on the placed image and choose Format Picture from the pop-up menu.



Step 6: Inserting text into the Header and Footer


To insert text into your letterhead, simply select the font style and size of the text you require, then enter the text into the header and footer box.











May 18, 2010 | Microsoft Compilers & Programming Tools

Tip

How to export datagridview data to excel in C#


First, add this to your namespace.<br /><span style="font-weight: bold;">using Microsoft.Office.Interop.Excel;</span><br /><br />Then, copy the codes below and paste it into the export button click event.<br /><br /> <span style="font-weight: bold;">Microsoft.Office.Interop.Excel.Application wapp;</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> Microsoft.Office.Interop.Excel.Worksheet wsheet;</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> Microsoft.Office.Interop.Excel.Workbook wbook;</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wapp = new Microsoft.Office.Interop.Excel.Application();</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wapp.Visible = false;</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wbook = wapp.Workbooks.Add(true);</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wsheet = (Worksheet)wbook.ActiveSheet;</span><br style="font-weight: bold;" /><br style="font-weight: bold;" /><span style="font-weight: bold;"> if (dataGridView1.RowCount == 0)</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> mssgbox_noretrieve();</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> return;</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> try</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> for (int i = 0; i &lt; this.dataGridView1.Columns.Count; i++)</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wsheet.Cells[1, i + 1] = this.dataGridView1.Columns[i].HeaderText;</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><br style="font-weight: bold;" /><span style="font-weight: bold;"> for (int i = 0; i &lt; this.dataGridView1.Rows.Count; i++)</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> DataGridViewRow row = this.dataGridView1.Rows[i];</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> for (int j = 0; j &lt; row.Cells.Count; j++)</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> DataGridViewCell cell = row.Cells[j];</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> try</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wsheet.Cells[i + 2, j + 1] = (cell.Value == null) ? "" : cell.Value.ToString();</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> catch (Exception ex)</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> MessageBox.Show(ex.Message);</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wapp.Visible = true;</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> catch (Exception ex1)</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> MessageBox.Show(ex1.Message);</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> wapp.UserControl = true;<br /><br /><br /><br /></span><br /> That's all and enjoy...<br /> Larrix<br /> <span style="font-weight: bold;"><br /></span>

on Jul 09, 2011 | Compilers & Programming Tools

Tip

How to datagridview to excel in C#


First, add this to your namespace.
using Microsoft.Office.Interop.Excel;

Then, copy the codes below and paste it into the export button click event.

Microsoft.Office.Interop.Excel.Application wapp;
Microsoft.Office.Interop.Excel.Worksheet wsheet;
Microsoft.Office.Interop.Excel.Workbook wbook;
wapp = new Microsoft.Office.Interop.Excel.Application();
wapp.Visible = false;
wbook = wapp.Workbooks.Add(true);
wsheet = (Worksheet)wbook.ActiveSheet;

if (dataGridView1.RowCount == 0)
{
mssgbox_noretrieve();
return;
}
try
{
for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
{
wsheet.Cells[1, i + 1] = this.dataGridView1.Columns[i].HeaderText;
}

for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
DataGridViewRow row = this.dataGridView1.Rows[i];
for (int j = 0; j < row.Cells.Count; j++)
{
DataGridViewCell cell = row.Cells[j];
try
{
wsheet.Cells[i + 2, j + 1] = (cell.Value == null) ? "" : cell.Value.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
wapp.Visible = true;
}
catch (Exception ex1)
{
MessageBox.Show(ex1.Message);
}
wapp.UserControl = true;




That's all and enjoy...
Larrix



on Jul 09, 2011 | Compilers & Programming Tools

2 Answers

How to make a code for log in using database?


RIGHT CLICK ON MY COMPUTER AND SELECT THE MANAGE AND SELECT USER AND GROUPS CLICK YOUR USER ON WHICH YOU WANT CREATE PASSWORD RIGHT CLICK THE USER AND SET PASSWORD AND FILL THE PASSWORD AND ENTER NOW YOUR PASSWORD WILL SET ENJOY

Oct 21, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

In microsoft excel sheet how do we copy zodiac signs written in front of employee from one sheet to another by writing a formulae in the blank space eg 1 amit scorpio 2 divik saggitarius 2 tisha...


When the cell is in a different sheet in the same file use:
=sheet-name!cell-name as in =Sheet1!A1

If the cell you want is in a different sheet in a different file use:
=[file-name]sheet-name!cell-name

as in: ='[sample excel 2.xls]Sheet1'!$A$1

The easiest way to do it is in the blank cell, type an equals sign "=" then go to the cell you want to copy, then press enter. All the correct formatting will be handled for you. (Sometimes you need quotes when you have spaces in the filenames and or sheet names.)

Sep 06, 2009 | Compilers & Programming Tools

1 Answer

Formula reqd in MS Excel


hi-lite the whole spreadsheet
go to data and select auto filter
you will see that each column will have an arrow at the top for a pull down menu
click on the city you want and you will only see the hospitals in that city
be sure to save your changes and the autofilter will be saved

May 17, 2009 | Compilers & Programming Tools

1 Answer

Write into excel format


You can use ADO or SQL to open the excel file directly (provided it is constructed correctly, ie fields names) and write the data to it without Access.
That might be eaiser thatn converting it from Access to Excel, if that can even be done.

Feb 17, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

Macro code for copying a range of cells from one Excell w/sheet t


You did not respond to my claification request. Here is some code that might help, it copies a selection of cells going down until an emty cell is found and across until an emty cell is found. This is form an earlier version of office but should comeclose to woring in 2007.

Sub copyrange()
'
' copyrange Macro
' Macro written by Royal 11/22/2008.
'


'save the return values
wksname = ActiveSheet.Name
returncell = ActiveCell.Address
searchfor = ActiveCell.Value

'go to first worksheet and find entered value (note this is a value serach)
Worksheets(1).Activate
findfor = "A1"
On Error Resume Next

findfor = Cells.Find(What:=searchfor, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False).Address
If findfor = "A1" Then
erwks = ActiveSheet.Name
Sheets(wksname).Activate
er = MsgBox("Search item not found on Worksheet" + erwks, , "Search Error")
Exit Sub
Else
findfor.Activate
End If

Cells.FindNext(After:=ActiveCell).Activate

'save this address and start searching for copy area boundaries
begcell = ActiveCell.Address
begcl = ActiveCell.Cells.Column
begri = ActiveCell.Cells.Row
'search amaximum of 1000 rows and 676 columns
endri = begri + 1000
endcl = 26 * 26
maxrow = 0
maxcol = 0

For col = Cells.Column To endcl
If Cells(begri, col) = "" Then
maxcol = col
col = endcl
ri = endri
Else
ri = begri
End If
For ri = ri To (Cells.Row + 1000)
If Cells(ri, col) = "" Then
If ri > maxrow Then
maxrow = ri
End If
ri = endri
End If
Next ri
Next col

maxrow = maxrow - 1
maxcol = maxcol - 1

'copy the selected area
endcell = Cells(maxrow, maxcol).Address
crnge = begcell & ":" & endcell
Range(crnge).Select
Selection.Copy
'go back and paste it in
Sheets(wksname).Activate
Range(returncell).Select
' use this if yo want to paste formulas etc.
'ActiveSheet.Paste
' use this code if you want to paste values instead of formulas etc.
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range(returncell).Select

Nov 20, 2008 | Compilers & Programming Tools

1 Answer

How to lock cell, column or row?


Lock (Colume / Row)
  1. Select colume or row that you want to lock (by default . it is locked)
  2. Right click and select menu 'Format cell'
  3. Click tab "Protection" and then check on "Lock" option.
  4. Click ok and close this dialog.
  5. Go to ribbon 'Review' and select "Protect sheet"
  6. Typing you password
  7. Saving and close your workbook and reopen again.

Nov 19, 2008 | Microsoft Compilers & Programming Tools

1 Answer

Export data in excel sheet and in specific column


I did not write this but look towards the end of the code and it will give you an idea on how to do it

Sub ExportToExcel(strOutputFile As String, Optional boolSuppressMessages As Boolean = False)

Dim strTemplateFile As String
Dim fso As Scripting.FileSystemObject
Dim cnn As ADODB.Connection
Dim rstTarget As ADODB.Recordset
Dim rstCustomers As ADODB.Recordset
Dim rstServiceReps As ADODB.Recordset

On Error GoTo ErrorHandler: On Error GoTo 0

Set fso = New Scripting.FileSystemObject

' Get template file path
strTemplateFile = CurrentProject.path & "\CompaniesEmployeesList.xlt"

' Copy template to the target
fso.CopyFile strTemplateFile, strOutputFile, False

' Open a connection to the workbook
Set cnn = New ADODB.Connection
cnn.Provider = "Microsoft.Jet.OLEDB.4.0"
cnn.ConnectionString = "Data Source=" & strOutputFile & ";" & _
"Extended Properties=""Excel 8.0"""
cnn.Mode = adModeReadWrite
cnn.Open

' Open the target recordset (the Excel sheet)
Set rstTarget = New ADODB.Recordset
rstTarget.Open "SELECT [ID], [Name], [City] " & _
"FROM [Sheet1$]", cnn, adOpenDynamic, adLockOptimistic

' Open Customer data recodset
Set rstCustomers = New ADODB.Recordset
rstCustomers.Open "SELECT CompanyID, CompanyName, City " & _
"FROM Customers " & _
"WHERE City = 'Madrid' " & _
"ORDER BY CompanyName", CurrentProject.Connection

' Open Service Rep data recodset
Set rstServiceReps = New ADODB.Recordset
rstServiceReps.Open "SELECT EmployeeID, [LastName] & "", "" & [FirstName] AS Name, City " & _
"FROM Employees " & _
"WHERE City = 'Madrid' " & _
"ORDER BY [LastName]", CurrentProject.Connection

' Loop through Customers result set and copy to target
Do While Not rstCustomers.EOF
rstTarget.AddNew
rstTarget![ID] = rstCustomers!CompanyID
rstTarget![Name] = rstCustomers!CompanyName
rstTarget![City] = rstCustomers!City
rstCustomers.MoveNext
Loop

' Insert blank line between result sets.
rstTarget.AddNew
rstTarget![ID] = ""
rstTarget![Name] = ""
rstTarget![City] = ""
rstTarget.Update

' Loop through Service Reps result set and copy to target
Do While Not rstServiceReps.EOF
rstTarget.AddNew
rstTarget![ID] = rstServiceReps!EmployeeID
rstTarget![Name] = rstServiceReps!Name
rstTarget![City] = rstServiceReps!City
rstTarget.Update
rstServiceReps.MoveNext
Loop

rstTarget.Close
rstCustomers.Close
rstServiceReps.Close

cnn.Close

If Not boolSuppressMessages Then
MsgBox "Workbook Created", vbInformation + vbOKOnly, "ExcelExport"
End If

ExitHere:
On Error Resume Next
Set rstTarget = Nothing
Set cnn = Nothing
Set rstCustomers = Nothing
Set rstServiceReps = Nothing
Exit Sub

ErrorHandler:
Eval "MsgBox(""Error " & Err.Number & "@" & Err.Description & "@"")"

On Error Resume Next

If Not cnn Is Nothing Then
cnn.Close
End If

Resume ExitHere

End Sub

Jan 03, 2008 | Compilers & Programming Tools

Not finding what you are looking for?
Compilers & Programming Tools Logo

Related Topics:

128 people viewed this question

Ask a Question

Usually answered in minutes!

Top Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Fred Block
Fred Block

Level 2 Expert

289 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18298 Answers

Are you a Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...