ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   updating data in rows from master list (https://www.excelbanter.com/excel-programming/277356-re-updating-data-rows-master-list.html)

Allen Nance

updating data in rows from master list
 


Steve,

Thanks for the very fast reply and thanks for the assistance.

You said "watch for word wrap, extraneous spaces (compile the code to
find errors).
check all the "(" & ")" to make sure I got them right."

I would have no idea what your talking about never mind knowing if it's
right :) I barely know how to open a sheet.

Word wrap I think I know, Spaces? Dunno, and checking the """"""'s and
the &'s well you got me.

Where would this code be placed and compile?

Sorry for the brain lameness, I just don't know this stuff.

Allen






*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

steve

updating data in rows from master list
 
Allen,

Than Welcome to the Wonderful World of VBA!

OK - let's take this a step at a time...

1. Start in Excel looking at your Master workbook.
2. Hold the Alt key and hit F11 (this will take you to the VBE)
You should be looking at 2 panels (left & right). If not...
3. Go to the View menu and select Project Explorer. Now you will
have a pane on the left titled "Project -VBAProject"
4. Find the listing for your workbook "VBAProject(Master)" and
select it.
5. Go to the Insert menu and select Module. A pane should open on
the right "Master - Module1(Code)
6. Select this pane and type:
Sub MySub
and hit enter. It will now look like this (create your own name in
place of Mysub
Sub Mysub()

End Sub
7. Now copy the code
lrow = Workbooks("Feed").Sheets("Sheet1").Cells(Rows.COUN T, _
"A").End(xlUp).Row
Application.ScreenUpdating = False ' helps speed up the code.
For x = 1 to lrow
Workbooks(Workbooks("Feed").Sheets("Sheet1").Cells (x,1) = _
Worksheetfunction.Index(Workbooks("Master").Sheets ("Sheet1"). _
Columns(2),Match(Workbooks(Workbooks("Feed"). _
Sheets("Sheet1").Cells(x,1),Worksheetfunction.Inde x( _
Workbooks("Master").Sheets("Sheet1").Columns(1),0) ,1)
Next
Application.ScreenUpdating = True
and paste in the empty space.
8. Now go to the Debug menu and select Compile.
Excel will now go through the code and pick out problem areas.
A highlighted space means unwanted spaces - delete them.
Post back with any other problems - sometimes the messages are not
very enlightening.
9. Save your workbook.
10. Return to the Excel window.
11. The code can now be accessed by holding the Alt key and hitting F8,
selecting the macro that you want and clicking Run.

Start here and post back...

--
sb
"Allen Nance" wrote in message
...


Steve,

Thanks for the very fast reply and thanks for the assistance.

You said "watch for word wrap, extraneous spaces (compile the code to
find errors).
check all the "(" & ")" to make sure I got them right."

I would have no idea what your talking about never mind knowing if it's
right :) I barely know how to open a sheet.

Word wrap I think I know, Spaces? Dunno, and checking the """"""'s and
the &'s well you got me.

Where would this code be placed and compile?

Sorry for the brain lameness, I just don't know this stuff.

Allen






*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Allen Nance

updating data in rows from master list
 


Steve,

followed the instructions... Got this error: Only comments, directives,
and declarations are permitted outside procedures.

"A").End(xlUp).Row on this xlUp was highlighted

code in vb


Sub Category()

End Sub

lrow = Workbooks("Feed").Sheets("Sheet1").Cells(Rows.Coun t, _
"A").End(xlUp).Row
Application.ScreenUpdating = False ' helps speed up the code.
For x = 1 To lrow
Workbooks(Workbooks("Feed").Sheets("Sheet1").Cells (x,1) = _
Worksheetfunction.Index(Workbooks("Master").Sheets ("Sheet1"). _
Columns(2),Match(Workbooks(Workbooks("Feed"). _
Sheets("Sheet1").Cells(x,1),Worksheetfunction.Inde x( _
Workbooks("Master").Sheets("Sheet1").Columns(1),0) ,1)
Next
Application.ScreenUpdating = True


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

updating data in rows from master list
 
Sub Category()

lrow = Workbooks("Feed.xls").Sheets("Sheet1").Cells(Rows. Count, _
"A").End(xlUp).Row
Application.ScreenUpdating = False ' helps speed up the code.
For x = 1 To lrow
Workbooks("Feed.xls").Sheets("Sheet1").Cells(x, 1) = _
WorksheetFunction.Index( _
Workbooks("Master.xls").Sheets("Sheet1"). _
Columns(2), Match(Workbooks("Feed.xls"). _
Sheets("Sheet1").Cells(x, 1), _
Workbooks("Master.xls").Sheets("Sheet1"). _
Columns(1), 0), 1)
Next
Application.ScreenUpdating = True

End Sub


--
Regards,
Tom Ogilvy



Allen Nance wrote in message
...


Steve,

followed the instructions... Got this error: Only comments, directives,
and declarations are permitted outside procedures.

"A").End(xlUp).Row on this xlUp was highlighted

code in vb


Sub Category()

End Sub

lrow = Workbooks("Feed").Sheets("Sheet1").Cells(Rows.Coun t, _
"A").End(xlUp).Row
Application.ScreenUpdating = False ' helps speed up the code.
For x = 1 To lrow
Workbooks(Workbooks("Feed").Sheets("Sheet1").Cells (x,1) = _
Worksheetfunction.Index(Workbooks("Master").Sheets ("Sheet1"). _
Columns(2),Match(Workbooks(Workbooks("Feed"). _
Sheets("Sheet1").Cells(x,1),Worksheetfunction.Inde x( _
Workbooks("Master").Sheets("Sheet1").Columns(1),0) ,1)
Next
Application.ScreenUpdating = True


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




steve

updating data in rows from master list
 
Allen,

Tom caught my error. I told you to paste the code in the "empty space".

I meant in the space after
Sub Mysub()
and before
End Sub

Thanks Tom for catching this...
(need to work on my communication skills)

--
sb
"Allen Nance" wrote in message
...


Steve,

followed the instructions... Got this error: Only comments, directives,
and declarations are permitted outside procedures.

"A").End(xlUp).Row on this xlUp was highlighted

code in vb


Sub Category()

End Sub

lrow = Workbooks("Feed").Sheets("Sheet1").Cells(Rows.Coun t, _
"A").End(xlUp).Row
Application.ScreenUpdating = False ' helps speed up the code.
For x = 1 To lrow
Workbooks(Workbooks("Feed").Sheets("Sheet1").Cells (x,1) = _
Worksheetfunction.Index(Workbooks("Master").Sheets ("Sheet1"). _
Columns(2),Match(Workbooks(Workbooks("Feed"). _
Sheets("Sheet1").Cells(x,1),Worksheetfunction.Inde x( _
Workbooks("Master").Sheets("Sheet1").Columns(1),0) ,1)
Next
Application.ScreenUpdating = True


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




steve

updating data in rows from master list
 
Tom,

Not close enough... My typo's got right past me.

Did realize that he pasted outside his procedure. That was due to poor
instructions from me earlier.

If I want to continue to help - I better proof read a lot better!!!
(usually I write the code in VBE and compile. didn't on this one)

Thanks for catching this!!! And thanks for your continued Support!!!

--
sb
"Tom Ogilvy" wrote in message
...
Did you look at his sample?

He has your code pasted in outside his procedure declaration.

Plus, there are some major typos in your code.

example - two instances of this:

Workbooks(Workbooks("Feed").Sheets("Sheet1").Cells (x,1) =

--
Regards,
Tom Ogilvy

steve wrote in message
...
Allen,

Make sure that this is on one line

lrow =
Workbooks("Feed").Sheets("Sheet1").Cells(Rows.Coun t,"A").End(xlUp).Row

The message you got means Excel is seeing text that it doesn't

understand.

--
sb
"Allen Nance" wrote in message
...


Steve,

followed the instructions... Got this error: Only comments,

directives,
and declarations are permitted outside procedures.

"A").End(xlUp).Row on this xlUp was highlighted

code in vb


Sub Category()

End Sub

lrow = Workbooks("Feed").Sheets("Sheet1").Cells(Rows.Coun t, _
"A").End(xlUp).Row
Application.ScreenUpdating = False ' helps speed up the code.
For x = 1 To lrow
Workbooks(Workbooks("Feed").Sheets("Sheet1").Cells (x,1) = _
Worksheetfunction.Index(Workbooks("Master").Sheets ("Sheet1").

_
Columns(2),Match(Workbooks(Workbooks("Feed"). _
Sheets("Sheet1").Cells(x,1),Worksheetfunction.Inde x( _
Workbooks("Master").Sheets("Sheet1").Columns(1),0) ,1)
Next
Application.ScreenUpdating = True


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!








Allen Nance

updating data in rows from master list
 


Thanks to both of you for your continued assistance.

It looks like the _ is a line terminator ?


The first thing I did was make sure the line mentioned on 1 line.

Line looks like this - lrow =
Workbooks("Feed.xls").Sheets("Sheet1").Cells(Rows. Count, _
"A").End(xlUp).Row



When I did this the " _ " before the "A").End(xlUp).Row errored with
invalid character and highlighted " _ "

so I removed the " _ " and made it look like this

lrow = Workbooks("Feed").Sheets("Sheet1").Cells(Rows.COUN T,
"A").End(xlUp).Row

Now when I debug I get a Compile error:

Sub or Function not defined

The word "Match" is highlighted. in the following line

Columns(2), Match(Workbooks("Feed.xls"). _

Now what? Was I wrong on the whole line? Or is it something else with
the command Match?

Allen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

updating data in rows from master list
 
I gave you a complete procedure, that if you copied it and pasted it into a
general module should compile without problem.

Now whether the functionality is correct or not - I haven't tested the logic
that Steve chose, but it appears to do what he describes.

--
Regards,
Tom Ogilvy


Allen Nance wrote in message
...


Thanks to both of you for your continued assistance.

It looks like the _ is a line terminator ?


The first thing I did was make sure the line mentioned on 1 line.

Line looks like this - lrow =
Workbooks("Feed.xls").Sheets("Sheet1").Cells(Rows. Count, _
"A").End(xlUp).Row



When I did this the " _ " before the "A").End(xlUp).Row errored with
invalid character and highlighted " _ "

so I removed the " _ " and made it look like this

lrow = Workbooks("Feed").Sheets("Sheet1").Cells(Rows.COUN T,
"A").End(xlUp).Row

Now when I debug I get a Compile error:

Sub or Function not defined

The word "Match" is highlighted. in the following line

Columns(2), Match(Workbooks("Feed.xls"). _

Now what? Was I wrong on the whole line? Or is it something else with
the command Match?

Allen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 02:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com