[values from many sheets]

K

Karol_tom

Hello,

I want to create user form which will contain:
-->RefEdit - to select cell
-->button OK - when I click on it, Excel will take value of this cell in
every sheet,
create new sheet (or probably create .txt file) and write all values from
sheets

In general I know what I want to do... but I don't now how --> Could you
give me some useful commands
or similar Excel VBA Project ?
 
C

CurlyDave

This code works without a UserForm,
Select a cell then run the code
'-----------------------------------------
Sub LoopThroughSheetsGetValue()


Dim ws As Worksheet
Dim r As Integer
Dim c As Integer
Dim ShtNm As String

r = ActiveCell.Row
c = ActiveCell.Column

ShtNm = InputBox("What is the New Sheet Name?")
Sheets.Add.Name = ShtNm

For Each ws In ActiveWorkbook.Worksheets

If ws.Name <> ShtNm Then

If ws.Visible = True Then
Range("A65536").End(xlUp).Offset(1, 0) = ws.Name
Range("A65536").End(xlUp).Offset(0, 1) = ws.Cells(r,
c).Value

End If

End If
Next ws

End Sub
'-----------------------------------------------------
 
D

Don Guillett Excel MVP

Hello,

I want to create user form which will contain:
-->RefEdit - to select cell
-->button OK - when I click on it, Excel will take value of this cell in
every sheet,
create new sheet (or probably create .txt file) and write all values from
sheets

In general I know what I want to do... but I don't now how --> Could you
give me some useful commands
or similar Excel VBA Project ?

"If desired, send your file to dguillett @gmail.com I will only look
if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top